• Модуль: mobile
  • Путь к файлу: ~/bitrix/modules/mobile/lib/rest/tasks.php
  • Класс: BitrixMobileRestTasks
  • Вызов: Tasks::getCanCreateTask
static function getCanCreateTask(array $params): bool
{
	$modules = ['mobile', 'tasks', 'socialnetwork'];
	foreach ($modules as $name)
	{
		if (!Loader::includeModule($name))
		{
			throw new BitrixRestRestException(
				"Module {$name} is not installed",
				'SERVER_ERROR',
				CRestServer::STATUS_WRONG_REQUEST
			);
		}
	}

	$userId = (int)$params['userId'];
	$groupId = (int)$params['groupId'];

	if (!$userId && !$groupId)
	{
		throw new BitrixRestRestException(
			'No data to get efficiency',
			'DATA_ERROR',
			CRestServer::STATUS_WRONG_REQUEST
		);
	}

	$userId = ($userId ?: User::getId());

	return SocialNetworkGroup::can($groupId, SocialNetworkGroup::ACTION_CREATE_TASKS, $userId);
}