- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_sect.php
- Класс: CCalendarSect
- Вызов: CCalendarSect::GetSectionPermission
static function GetSectionPermission(array $array, $getPermissions = null)
{
$res = [];
$accessCodes = [];
foreach ($array as $section)
{
$sectId = $section['ID'];
$userId = CCalendar::GetUserId();
$accessController = new SectionAccessController($userId);
$sectionModel = SectionModel::createFromArray($section);
$request = [
ActionDictionary::ACTION_SECTION_EVENT_VIEW_TIME => [],
ActionDictionary::ACTION_SECTION_EVENT_VIEW_TITLE => [],
ActionDictionary::ACTION_SECTION_EVENT_VIEW_FULL => [],
ActionDictionary::ACTION_SECTION_ADD => [],
ActionDictionary::ACTION_SECTION_EDIT => [],
ActionDictionary::ACTION_SECTION_ACCESS => [],
];
$result = $accessController->batchCheck($request, $sectionModel);
if ($result[ActionDictionary::ACTION_SECTION_EVENT_VIEW_TIME])
{
$section['PERM'] = [
'view_time' => $result[ActionDictionary::ACTION_SECTION_EVENT_VIEW_TIME],
'view_title' => $result[ActionDictionary::ACTION_SECTION_EVENT_VIEW_TITLE],
'view_full' => $result[ActionDictionary::ACTION_SECTION_EVENT_VIEW_FULL],
'add' => $result[ActionDictionary::ACTION_SECTION_ADD],
'edit' => $result[ActionDictionary::ACTION_SECTION_EDIT],
'edit_section' => $result[ActionDictionary::ACTION_SECTION_EDIT],
'access' => $result[ActionDictionary::ACTION_SECTION_ACCESS],
];
if ($getPermissions || $section['PERM']['access'] || $section['CAL_TYPE'] === 'location')
{
$section['ACCESS'] = [];
if (
isset(self::$Permissions[$sectId])
&& is_array(self::$Permissions[$sectId])
&& !empty(self::$Permissions[$sectId])
)
{
// Add codes to get they full names for interface
$currentAccessCodes = array_keys(self::$Permissions[$sectId]);
foreach ($currentAccessCodes as $code)
{
if (!in_array($code, $accessCodes, true))
{
$accessCodes[] = $code;
}
}
$section['ACCESS'] = self::$Permissions[$sectId];
}
}
CCalendar::PushAccessNames($accessCodes);
$res[] = $section;
}
}
return $res;
}