• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/integration/rest/task/userfield.php
  • Класс: BitrixTasksIntegrationRestTaskis
  • Вызов: is::runRestMethod
static function runRestMethod($executiveUserId, $methodName, array $args)
{
	if (!Restriction::canManage(static::getTargetEntityId(), $executiveUserId))
	{
		// todo: raising an exception is bad, but still we got no error collection to return here
		throw new SystemException('Action not allowed');
	}

	switch (mb_strtolower($methodName))
	{
		case 'getlist':
			if (empty($args))
			{
				$args = [[], []];
			}
			else
			{
				if (!is_array($args[0]))
				{
					$args[0] = [];
				}
				if (!is_array($args[1]))
				{
					$args[1] = [];
				}
			}
			break;

		case 'get':
			if (empty($args))
			{
				throw new ArgumentException('No parameters found.');
			}
			break;

		case 'add':
			if (count($args) > 1 || !is_array($args[0]))
			{
				$args = [$args];
			}
			break;
	}

	return parent::runRestMethod($executiveUserId, $methodName, $args);
}