• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/helper/task/template/access.php
  • Класс: BitrixTasksInternalsHelperTaskTemplateAccess
  • Вызов: Access::getAvailableOperations
static function getAvailableOperations($ids, array $parameters = [])
{
	$userId = $parameters['USER_ID'];

	// update b_user_access for the chosen user
	$access = new CAccess();
	$access->updateCodes(['USER_ID' => $userId]);

	$result = [];

	if (
		!is_array($ids)
		|| empty($ids)
		|| !$userId
	)
	{
		return $result;
	}

	$ops = BitrixTasksUtilUser::getAccessOperationsForEntity('task_template');
	foreach ($ops as $id => $row)
	{
		$ops[$row['NAME']] = $id;
	}

	foreach ($ids as $id)
	{
		if (TemplateAccessController::can($userId, ActionDictionary::ACTION_TEMPLATE_EDIT, $id))
		{
			$result[$id][] = $ops['read'];
			$result[$id][] = $ops['update'];
			$result[$id][] = $ops['delete'];
		}
		elseif (TemplateAccessController::can($userId, ActionDictionary::ACTION_TEMPLATE_READ, $id))
		{
			$result[$id][] = $ops['read'];
		}
	}

	return $result;
}