• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/access/rule/taskraterule.php
  • Класс: BitrixTasksAccessRuleTaskRateRule
  • Вызов: TaskRateRule::execute
public function execute(AccessibleItem $task = null, $params = null): bool
{
	if (!$task)
	{
		$this->controller->addError(static::class, 'Incorrect task');
		return false;
	}

	if ($this->user->isAdmin())
	{
		return true;
	}

	if (
		$task->isMember($this->user->getUserId(), RoleDictionary::ROLE_DIRECTOR)
	)
	{
		return true;
	}

	if (
		$task->getGroupId()
		&& Loader::includeModule("socialnetwork")
		&& BitrixSocialnetworkInternalsRegistryFeaturePermRegistry::getInstance()->get(
			$task->getGroupId(),
			'tasks',
			'edit_tasks',
			$this->user->getUserId()
		)
	)
	{
		return true;
	}

	if (array_intersect($task->getMembers(RoleDictionary::ROLE_DIRECTOR), $this->user->getAllSubordinates()))
	{
		return true;
	}

	$this->controller->addError(static::class, 'Access to rate task denied');
	return false;
}