1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2026-05-18 18:11:05 +02:00
This commit is contained in:
IvanSergeev
2026-03-20 16:30:25 +04:00
parent 02c0828c33
commit e5383da771
3 changed files with 35 additions and 3 deletions
@@ -0,0 +1,15 @@
# Restriction on setting the "Server Call" flag for common modules
Don't force the Call Server checkbox on all common modules with the Server flag.
Such shared modules should contain only those procedures and functions that are truly intended to be called from
client code and guarantee the execution of only those actions (and the transfer of only those data to the client)
that the user is authorized to perform while working in the program. For example, a server function implementing
a calculation algorithm should transfer the final result of that calculation to the client, but not the initial
(or intermediate) data for the calculation, which may not be accessible to the current user.
## Noncompliant Code Example
## Compliant Solution
## See
[Restrictions on the use of Run and Eval on the server]https://its.1c.ru/db/v8std#content:679:hdoc
@@ -0,0 +1,17 @@
#Ограничение на установку признака «Вызов сервера» у общих модулей
Не следует всем общим модулям с признаком Сервер принудительно устанавливать флажок Вызов сервера.
В таких общих модулях следует размещать только те процедуры и функции, которые действительно предназначены для
вызова из клиентского кода и гарантируют выполнение только тех действий
(и передачи только тех данных на сторону клиента), которые разрешены пользователю при его работе в программе.
Например, серверная функция, реализующая некоторый алгоритм расчета, должна передавать на сторону клиента
окончательный результат этого расчета, но не исходные (или промежуточные) данные для расчета, которые сами по
себе могут быть недоступны текущему пользователю.
## Неправильно
## Правильно
## See
[Ограничение на установку признака «Вызов сервера» у общих модулей]https://its.1c.ru/db/v8std#content:679:hdoc
@@ -140,7 +140,7 @@ public class CommonModuleServerCallCheck
private boolean callInOtherModule(Method object, IProgressMonitor monitor, IBmTransaction bmTransaction)
{
boolean clientCall = false;
List<URI> URIs = new ArrayList<>();
List<URI> uRIs = new ArrayList<>();
IProgressMonitor subMonitor = new NullProgressMonitor()
{
@Override
@@ -197,10 +197,10 @@ public class CommonModuleServerCallCheck
referenceFinder.findAllReferences(targetUris, workSpaceResourceAccess, indexData, acceptor, subMonitor);
if (!URIs.isEmpty())
if (!uRIs.isEmpty())
{
List<Boolean> checkClientCall = new ArrayList<>();
for (URI uri : URIs)
for (URI uri : uRIs)
{
EObject obj = bmTransaction.getExternalObjectByUri(uri);
Method method = EcoreUtil2.getContainerOfType(obj, Method.class);