SectionAccessRule::execute

  1. Bitrix24 API (v. 23.675.0)
  2. calendar
  3. SectionAccessRule
  4. execute
  • Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/access/rule/sectionaccessrule.php
  • Класс: BitrixCalendarAccessRuleSectionAccessRule
  • Вызов: SectionAccessRule::execute
public function execute(AccessibleItem $item = null, $params = null): bool
{
	if (!$item instanceof SectionModel)
	{
		return false;
	}

	if (!$this->hasCurrentUser())
	{
		return true;
	}

	if ($this->user->isAdmin() || $this->user->isSocNetAdmin($item->getType()))
	{
		return true;
	}

	if ($this->isOwner($item, $this->user->getUserId()))
	{
		return true;
	}

	$type = TypeModel::createFromSectionModel($item);
	$typeCheck = true;

	if ($item->getType() !== BitrixCalendarCoreEventToolsDictionary::CALENDAR_TYPE['resource'])
	{
		$typeCheck = $this->controller->check(ActionDictionary::ACTION_TYPE_ACCESS, $type);
	}

	return
		$typeCheck
		&& in_array(
			ActionDictionary::getOldActionKeyByNewActionKey(ActionDictionary::ACTION_SECTION_ACCESS),
			CCalendarSect::GetOperations($item->getId(), $this->user->getUserId()),
			true
		);
}

Добавить комментарий