• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Chat.php
  • Класс: Bitrix\Im\V2\Chat
  • Вызов: Chat::getRole
public function getRole(): string
{
	if (isset($this->role))
	{
		return $this->role;
	}

	if ($this->getContext()->getUserId() === (int)$this->getAuthorId())
	{
		$this->role = self::ROLE_OWNER;

		return $this->role;
	}

	$selfRelation = $this->getSelfRelation();

	if ($selfRelation === null)
	{
		$this->role = self::ROLE_GUEST;
	}
	elseif ($selfRelation->getManager())
	{
		$this->role = self::ROLE_MANAGER;
	}
	else
	{
		$this->role = self::ROLE_MEMBER;
	}

	return $this->role;
}