• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_sect.php
  • Класс: CCalendarSect
  • Вызов: CCalendarSect::GetOperations
static function GetOperations($sectId, $userId = null)
{
	if (!$userId)
	{
		$userId = CCalendar::GetCurUserId();
	}

	if ((int)$sectId && (int)$userId && !self::$bClearOperationCache)
	{
		$sectionPermKey = $userId . '|' . $sectId;
		if (isset(self::$userSectionPermissions[$sectionPermKey]))
		{
			return self::$userSectionPermissions[$sectionPermKey];
		}
	}

	$codes = Util::getUserAccessCodes($userId);

	$key = $sectId.'|'.implode(',', $codes);
	if (self::$bClearOperationCache || !is_array(self::$arOp[$key] ?? null))
	{
		if (!isset(self::$Permissions[$sectId]))
		{
			self::GetArrayPermissions([$sectId]);
		}
		$perms = self::$Permissions[$sectId];

		self::$arOp[$key] = [];
		if (is_array($perms))
		{
			foreach ($perms as $code => $taskId)
			{
				if (in_array($code, $codes, true))
				{
					self::$arOp[$key] = array_merge(self::$arOp[$key], CTask::GetOperations($taskId, true));
				}
			}
		}
	}

	if ((int)$sectId && (int)$userId)
	{
		$sectionPermKey = $userId . '|' . $sectId;
		self::$userSectionPermissions[$sectionPermKey] = self::$arOp[$key];
	}

	self::$bClearOperationCache = false;

	return self::$arOp[$key];
}