- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/rights.php
- Класс: BitrixLandingRights
- Вызов: Rights::setOperations
static function setOperations($entityId, $entityType, array $rights = [])
{
if (!self::isFeatureOn())
{
return false;
}
$tasks = self::getAccessTasksReferences();
$entityId = intval($entityId);
self::removeData(
$entityId,
$entityType
);
// add new rights
foreach ($rights as $accessCode => $rightCodes)
{
$rightCodes = (array) $rightCodes;
if (in_array(self::ACCESS_TYPES['denied'], $rightCodes))
{
$rightCodes = [self::ACCESS_TYPES['denied']];
}
else if (!in_array(self::ACCESS_TYPES['read'], $rightCodes))
{
$rightCodes[] = self::ACCESS_TYPES['read'];
}
foreach ($rightCodes as $rightCode)
{
if (isset($tasks[$rightCode]))
{
RightsTable::add([
'ENTITY_ID' => $entityId,
'ENTITY_TYPE' => $entityType,
'TASK_ID' => $tasks[$rightCode],
'ACCESS_CODE' => $accessCode
]);
}
}
}
return true;
}