Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
UserRoleManager.php
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Space\List
;
4
5
use
Bitrix\Socialnetwork\UserToGroupTable
;
6
7
final
class
UserRoleManager
8
{
9
public
function
getUserRole
(?
string
$groupRole, ?
string
$initiatedBy): string
10
{
11
$userRole =
Dictionary::USER_ROLES
[
'nonMember'
];
12
13
$memberRoles = [
14
UserToGroupTable::ROLE_OWNER
,
15
UserToGroupTable::ROLE_MODERATOR
,
16
UserToGroupTable::ROLE_USER
,
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
}
Bitrix\Socialnetwork\Space\List\Dictionary\USER_ROLES
const USER_ROLES
Definition
Dictionary.php:19
Bitrix\Socialnetwork\Space\List\UserRoleManager
Definition
UserRoleManager.php:8
Bitrix\Socialnetwork\Space\List\UserRoleManager\getUserRole
getUserRole(?string $groupRole, ?string $initiatedBy)
Definition
UserRoleManager.php:9
Bitrix\Socialnetwork\UserToGroupTable
Definition
usertogroup.php:33
Bitrix\Socialnetwork\UserToGroupTable\ROLE_USER
const ROLE_USER
Definition
usertogroup.php:36
Bitrix\Socialnetwork\UserToGroupTable\ROLE_REQUEST
const ROLE_REQUEST
Definition
usertogroup.php:38
Bitrix\Socialnetwork\UserToGroupTable\INITIATED_BY_GROUP
const INITIATED_BY_GROUP
Definition
usertogroup.php:41
Bitrix\Socialnetwork\UserToGroupTable\INITIATED_BY_USER
const INITIATED_BY_USER
Definition
usertogroup.php:40
Bitrix\Socialnetwork\UserToGroupTable\ROLE_MODERATOR
const ROLE_MODERATOR
Definition
usertogroup.php:35
Bitrix\Socialnetwork\UserToGroupTable\ROLE_OWNER
const ROLE_OWNER
Definition
usertogroup.php:34
Bitrix\Socialnetwork\Space\List
Definition
Dictionary.php:3
modules
socialnetwork
lib
Space
List
UserRoleManager.php
Создано системой
1.10.0