• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Chat/GeneralChat.php
  • Класс: BitrixImV2ChatGeneralChat
  • Вызов: GeneralChat::hasPostAccess
public function hasPostAccess(?int $userId = null): bool
{
	if ($this->getId() === null || $this->getId() === 0)
	{
		return false;
	}

	if ($this->getCanPost() === Chat::MANAGE_RIGHTS_NONE)
	{
		return false;
	}

	$userId ??= $this->getContext()->getUserId();
	if ($this->getCanPost() === Chat::MANAGE_RIGHTS_MEMBER)
	{
		return true;
	}

	if ($this->getAuthorId() === $userId)
	{
		return true;
	}

	if ($this->getCanPost() === Chat::MANAGE_RIGHTS_OWNER)
	{
		return false;
	}

	return in_array($userId, $this->getManagerList(), true);
}