- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/access/rule/taskapproverule.php
- Класс: BitrixTasksAccessRuleTaskApproveRule
- Вызов: TaskApproveRule::execute
public function execute(AccessibleItem $task = null, $params = null): bool
{
if (!$task)
{
$this->controller->addError(static::class, 'Incorrect task');
return false;
}
if ($task->getStatus() !== Status::SUPPOSEDLY_COMPLETED)
{
$this->controller->addError(static::class, 'Task is already completed');
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')
&& FeaturePermRegistry::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 approve task denied');
return false;
}