SectionEventViewTitleRule::execute

  1. Bitrix24 API (v. 23.675.0)
  2. calendar
  3. SectionEventViewTitleRule
  4. execute
  • Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/access/rule/sectioneventviewtitlerule.php
  • Класс: BitrixCalendarAccessRuleSectionEventViewTitleRule
  • Вызов: SectionEventViewTitleRule::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()) || $this->isManager($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_VIEW, $type);
	}

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

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