...Человеческий поиск в разработке...
- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/rights.php
- Класс: BitrixLandingRights
- Вызов: Rights::getOperations
static function getOperations($entityId, $entityType) { // full access for allowed sites if ( $entityType == self::ENTITY_TYPE_SITE && in_array($entityId, self::$allowedSites) ) { $types = self::ACCESS_TYPES; unset($types[self::ACCESS_TYPES['delete']]); return array_values($types); } // check scoped method if ( $entityType == self::ENTITY_TYPE_SITE && !is_array($entityId) && $entityId > 0 ) { $scopeOperationsSite = SiteType::getOperationsForSite($entityId); if ($scopeOperationsSite !== null) { return array_values($scopeOperationsSite); } } $operations = []; $operationsDefault = []; $wasChecked = false; $uid = self::getContextUserId(); $extendedMode = self::isExtendedMode(); // full access for admin if ( $uid && self::isOn() && !self::isAdmin() && self::isFeatureOn() && self::exist() ) { $wasChecked = true; $entityIdFilter = $entityId; if (is_array($entityIdFilter)) { $entityIdFilter[] = 0; } else { $entityIdFilter = [ $entityIdFilter, 0 ]; } $filter = [ 'ENTITY_ID' => $entityIdFilter, '=ENTITY_TYPE' => $entityType, 'USER_ACCESS.USER_ID' => $uid, '!TASK_OPERATION.OPERATION.NAME' => false ]; if ($extendedMode) { $filter['ROLE_ID'] = 0; } else { $filter['ROLE_ID'] = Role::getExpectedRoleIds(); } $res = RightsTable::getList( [ 'select' => [ 'ENTITY_ID', 'OPERATION_NAME' => 'TASK_OPERATION.OPERATION.NAME' ], 'filter' => $filter ] ); while ($row = $res->fetch()) { if ($row['ENTITY_ID'] == 0) { $operationsDefault[] = mb_substr($row['OPERATION_NAME'], 8); continue; } if (!isset($operations[$row['ENTITY_ID']])) { $operations[$row['ENTITY_ID']] = array(); } $operations[$row['ENTITY_ID']][] = mb_substr($row['OPERATION_NAME'], 8); $operations[$row['ENTITY_ID']] = array_unique($operations[$row['ENTITY_ID']]); } } // set full rights, if rights are empty foreach ((array) $entityId as $id) { if (!isset($operations[$id])) { if ($wasChecked && !$extendedMode) { $operations[$id] = !empty($operationsDefault) ? $operationsDefault : [self::ACCESS_TYPES['denied']]; } else { $operations[$id] = array_values(self::ACCESS_TYPES); } } } return is_array($entityId) ? $operations : $operations[$entityId]; }