• Модуль: rest
  • Путь к файлу: ~/bitrix/modules/rest/lib/api/user.php
  • Класс: BitrixRestApiUser
  • Вызов: User::prepareUserFilter
static function prepareUserFilter($query, $allowedUserFields = null, $clearFilterType = []): array
{
	$filter = [];

	if (!$allowedUserFields)
	{
		$allowedUserFields = static::getDefaultAllowedUserFields();
	}

	foreach ($query as $code => $value)
	{
		$filterType = '';
		$matches = [];
		if (preg_match('/^([W]{1,2})(.+)/', $code, $matches) && $matches[2])
		{
			$filterType = $matches[1];
			$code = $matches[2];
		}

		if (in_array($code, $allowedUserFields, true))
		{
			if ($filterType !== '' && in_array($code, $clearFilterType, true))
			{
				$filterType = '';
			}
			elseif ($filterType === '' && in_array($code, ['USER_TYPE', 'ACTIVE'], true))
			{
				$filterType = '=';
			}

			$filter[$filterType . $code] = static::prepareUserValue($code, $value);
		}
	}

	return $filter;
}