Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
UserRoleManager.php
1<?php
2
4
6
7final class UserRoleManager
8{
9 public function getUserRole(?string $groupRole, ?string $initiatedBy): string
10 {
11 $userRole = Dictionary::USER_ROLES['nonMember'];
12
13 $memberRoles = [
17 ];
18
19 if ($groupRole === UserToGroupTable::ROLE_REQUEST)
20 {
21 if ($initiatedBy === UserToGroupTable::INITIATED_BY_USER)
22 {
23 $userRole = Dictionary::USER_ROLES['applicant'];
24 }
25 elseif ($initiatedBy === UserToGroupTable::INITIATED_BY_GROUP)
26 {
27 $userRole = Dictionary::USER_ROLES['invited'];
28 }
29 }
30 elseif (in_array($groupRole, $memberRoles))
31 {
32 $userRole = Dictionary::USER_ROLES['member'];
33 }
34
35 return $userRole;
36 }
37}
getUserRole(?string $groupRole, ?string $initiatedBy)