• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/classes/general/im_rest.php
  • Класс: CIMRestService
  • Вызов: CIMRestService::departmentEmployeesGet
static function departmentEmployeesGet($arParams, $n, CRestServer $server)
{
	if (
		BitrixImUser::getInstance()->isExtranet()
		|| BitrixImUser::getInstance()->isBot()
	)
	{
		throw new BitrixRestRestException("Only intranet users have access to this method.", "ACCESS_ERROR", CRestServer::STATUS_FORBIDDEN);
	}

	$arParams = array_change_key_case($arParams, CASE_UPPER);

	$withUserData = $arParams['USER_DATA'] == 'Y';

	$ids = Array();
	if (is_string($arParams['ID']))
	{
		$arParams['ID'] = CUtil::JsObjectToPhp($arParams['ID']);
	}
	if (is_array($arParams['ID']))
	{
		foreach ($arParams['ID'] as $id)
		{
			$id = intval($id);
			if ($id > 0)
			{
				$ids[$id] = $id;
			}
		}
	}

	if (empty($ids))
	{
		throw new BitrixRestRestException("Department ID can't be empty", "ID_EMPTY", CRestServer::STATUS_WRONG_REQUEST);
	}

	return BitrixImDepartment::getEmployees($ids, array('JSON' => 'Y', 'USER_DATA' => $withUserData? 'Y': 'N'));
}