• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/security/currentuser.php
  • Класс: BitrixMainSecurityCurrentUser
  • Вызов: CurrentUser::exportToArray
public function exportToArray()
{
	$data = array(
		"AUTHORIZED" => $this->isAuthenticated ? "Y" : "N",
		"ADMIN" => $this->isAdmin,
	);

	if ($this->isAuthenticated)
	{
		$data["USER_ID"] = $this->userId;

		$ar = array("LOGIN" => "login", "EMAIL" => "email", "FIRST_NAME" => "firstName",
			"SECOND_NAME" => "secondName", "LAST_NAME" => "lastName", "AUTO_TIME_ZONE" => "isAutoTimezone",
			"TIME_ZONE" => "timezone");
		foreach ($ar as $k => $v)
		{
			if (isset($this->{$v}))
				$data[$k] = $this->{$v};
		}

		if (isset($data["AUTO_TIME_ZONE"]))
			$data["AUTO_TIME_ZONE"] = ($data["AUTO_TIME_ZONE"] ? "Y" : "N");
	}

	if (isset($this->policy))
		$data["POLICY"] = $this->policy;
	if (isset($this->userGroups))
		$data["GROUPS"] = $this->userGroups;

	return $data;
}