Метод withAccessCheck
Сигнатура метода
public function withAccessCheck(?int $userId = null, AccessMode $mode = AccessMode::Filter): static
Возвращает:
static
Описание
Returns a configured copy that runs every read through CRM read permissions. - {@see AccessMode::Filter} (default) — items the user can't read are excluded. `getById()` returns `null`; `getList()` filters at the DB level so LIMIT/OFFSET act on the visible subset, mirroring {@see \Bitrix\Crm\Service\Factory::getItemsFilteredByPermissions()}. - {@see AccessMode::Restricted} — unreadable items are still returned, but as data-less stubs: only the id survives, `canRead()` is `false`, scalar accessors yield nothing and relations are not loaded, so no protected data leaks. Readable items are returned in full. Use this for cards / timelines / kanbans that need a placeholder row. Anonymous user (`userId === 0`): every item is denied — `Filter` returns empty, `Restricted` returns every item as a data-less stub.
Параметры
2| Имя | Тип | По умолчанию | Флаги |
|---|---|---|---|
$userId
|
?int
|
null
|
—
|
$mode
|
AccessMode
|
AccessMode::Filter
|
—
|
Расположение
Исходный файл метода в Bitrix Framework
~/bitrix/modulescrm/lib/V2/Public/Provider/Item/AbstractItemProvider.php