• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Entity/User/User.php
  • Класс: BitrixImV2EntityUserUser
  • Вызов: User::hasAccess
public function hasAccess(?int $idOtherUser = null): bool
{
	$idOtherUser = $idOtherUser ?? Locator::getContext()->getUserId();

	$otherUser = User::getInstance($idOtherUser);

	if (!$otherUser->isExist())
	{
		return false;
	}

	if ($this->getId() === $idOtherUser)
	{
		return true;
	}

	if (isset($this->accessCache[$idOtherUser]))
	{
		return $this->accessCache[$idOtherUser];
	}

	$this->accessCache[$idOtherUser] = $this->checkAccessWithoutCaching($otherUser);

	return $this->accessCache[$idOtherUser];
}