- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/access/rule/checklisttogglerule.php
- Класс: BitrixTasksAccessRuleChecklistToggleRule
- Вызов: ChecklistToggleRule::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 instanceof TemplateModel)
{
return $this->controller->check(ActionDictionary::ACTION_CHECKLIST_EDIT, $task, $params);
}
if (!$this->controller->check(ActionDictionary::ACTION_TASK_READ, $task, $params))
{
return false;
}
$checklist = $this->getModelFromParams($params);
if ($checklist->getEntityId() !== $task->getId())
{
$this->controller->addError(static::class, 'Incorrect checklist');
return false;
}
if (
$task->isMember($this->user->getUserId(), RoleDictionary::ROLE_DIRECTOR)
|| $task->isMember($this->user->getUserId(), RoleDictionary::ROLE_RESPONSIBLE)
|| $task->isMember($this->user->getUserId(), RoleDictionary::ROLE_ACCOMPLICE)
)
{
return true;
}
return $this->controller->check(ActionDictionary::ACTION_CHECKLIST_EDIT, $task, $params);
}