• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/access/rule/taskcreaterule.php
  • Класс: BitrixTasksAccessRuleTaskCreateRule
  • Вызов: TaskCreateRule::checkGroupPermission
private function checkGroupPermission(AccessibleItem $task): bool
{
	$group = $task->getGroup();
	if (!$group)
	{
		$this->controller->addError(static::class, 'Unable to load group info');
		return false;
	}

	// tasks disabled for group
	// the group is archived
	if (
		!$group['TASKS_ENABLED']
		|| $group['CLOSED'] === 'Y'
	)
	{
		$this->controller->addError(static::class, 'Unable to create task bc group is closed or tasks disabled');
		return false;
	}

	// default access for group
	if (!Loader::includeModule('socialnetwork'))
	{
		$this->controller->addError(static::class, 'Unable to load socialnetwork');
		return false;
	}

	if (!BitrixSocialnetworkInternalsRegistryFeaturePermRegistry::getInstance()->get(
		$task->getGroupId(),
		'tasks',
		'create_tasks',
		$this->user->getUserId()
	))
	{
		$this->controller->addError(static::class, 'Access to create task denied by group permissions');
		return false;
	}

	return true;
}