- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/V2/Chat/Permission.php
- Класс: BitrixImV2ChatPermission
- Вызов: Permission::compareRole
static function compareRole(string $userRole, string $needRole): bool
{
if ($needRole === Chat::ROLE_NONE)
{
return false;
}
$ascendingRoles = [Chat::ROLE_GUEST, Chat::ROLE_MEMBER, Chat::ROLE_MANAGER, Chat::ROLE_OWNER];
$userRolePos = array_search($userRole, $ascendingRoles, true);
$needRolePos = array_search($needRole, $ascendingRoles, true);
if ($userRole === false || $needRolePos === false)
{
return false;
}
return $userRolePos >= $needRolePos;
}