• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Entity/User/User.php
  • Класс: BitrixImV2EntityUserUser
  • Вызов: User::isAdmin
public function isAdmin(): bool
{
	if ($this->isAdmin !== null)
	{
		return $this->isAdmin;
	}

	global $USER;
	if (Loader::includeModule('bitrix24'))
	{
		if (
			$USER instanceof CUser
			&& $USER->isAuthorized()
			&& $USER->isAdmin()
			&& (int)$USER->getId() === $this->getId()
		)
		{
			$this->isAdmin = true;

			return $this->isAdmin;
		}
		$this->isAdmin = CBitrix24::isPortalAdmin($this->getId());

		return $this->isAdmin;
	}

	if (
		$USER instanceof CUser
		&& $USER->isAuthorized()
		&& (int)$USER->getId() === $this->getId()
	)
	{
		$this->isAdmin = $USER->isAdmin();

		return $this->isAdmin;
	}

	$result = false;
	$groups = UserTable::getUserGroupIds($this->getId());
	foreach ($groups as $groupId)
	{
		if ((int)$groupId === 1)
		{
			$result = true;
			break;
		}
	}
	$this->isAdmin = $result;

	return $this->isAdmin;
}