Метод isReadableForDeletion

private static

Сигнатура метода

private static function isReadableForDeletion(int $ID, mixed $checkPerms, ActivityOperationContext $operationContext): bool

Возвращает: bool

Описание

The hidden check of the right to READ the activity a delete is about (:1289, item B2 of LBS-3) - the one check of a write path that belongs to the facade and not to the service, because it is a behaviour of this entry point rather than a rule of the domain: the service checks only the restriction on removing the record of a call. A REFUSAL IS INDISTINGUISHABLE FROM AN ABSENCE, and that is the contract rather than an oversight (item D15 of LBS-3): legacy answers a plain false and registers no error, so a caller cannot tell "you may not read it" from "there is none". The service is free to have a typed error of its own; none of it comes out here, because the operation is never started. A STATE HANDED OVER BY THE CALLER REPLACES THE READ AND THEREFORE BYPASSES THE CHECK (item E6.7): the mass operations of the portal hand one over, and legacy skips its own read for exactly the same reason. THE READ HAPPENS ONLY WHERE IT CHECKS SOMETHING. In legacy the same read serves two purposes at once - the check and the state every row below works on - so it runs whatever the switch says. Here the state is read by the pipeline through the boundary of the storage, so a read with the check off would be a query that answers a question nobody asked. The switch is read as legacy reads it for this one purpose - truthy, not strictly true - which is why an activity of a caller passing 1 is still checked while the restriction on the calls is not. IT ASKS FOR ONE BIT AND MATERIALIZES NO ROW. `GetByID()` would select every column of the table plus the joins of its default select to answer a question about a single bit, and nothing here reads the row it returns. `GetCount()` is the narrow form of the very same question: it goes through `GetList()`, therefore through the same `BuildPermSql()` and the same filter, so the answer is the answer of legacy on every input - an activity that is there and readable, one that is there and is not, one that is not there at all. THE PER-HIT CACHE IS STILL CONSULTED, and that is fidelity rather than an optimization. `GetByID()` answers out of it before it looks at the rights at all, so an activity somebody has already read in this hit - with the check of the rights off, possibly - counts as readable here today. Skipping the cache would refuse deletions that go through now, which is a change of behaviour and not a narrower query. THE ANSWER STAYS AN ANSWER AND DOES NOT BECOME THE STATE OF THE RUN. Handing the read row on to the operation as the state of the caller would make one operation take two different paths by the switch of the rights: `ACTUAL_ITEM` is what decides where a delete takes its list of files from ({@see self::InnerDelete()}), so an item present only when the rights are checked would change what the delete does and not only how much it reads. The second read of the row belongs to the pipeline and is removed together with the move of the callers onto the typed access layer.

Параметры

3
Имя Тип По умолчанию Флаги
$ID int —
—
$checkPerms mixed —
—
$operationContext ActivityOperationContext —
—

Расположение

Исходный файл метода в Bitrix Framework

Путь к исходному файлу Source
~/bitrix/modulescrm/classes/general/crm_activity.php
Расположение метода в файле
Строки 1876–1893

Исходный код

PHP