Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
role.php
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Internals\Counter
;
4
5
use
Bitrix\Socialnetwork\UserToGroupTable
;
6
7
class
Role
8
{
9
public
const
ENTITY_WORKGROUP
=
'WORKGROUP'
;
10
11
public
const
PREFIX_WORKGROUP
=
'WORKGROUP_'
;
12
13
public
const
ALL
=
''
;
14
public
const
WORKGROUP_OWNER
= self::PREFIX_WORKGROUP .
UserToGroupTable::ROLE_OWNER
;
15
public
const
WORKGROUP_MODERATOR
= self::PREFIX_WORKGROUP .
UserToGroupTable::ROLE_MODERATOR
;
16
public
const
WORKGROUP_USER
= self::PREFIX_WORKGROUP .
UserToGroupTable::ROLE_USER
;
17
public
const
WORKGROUP_REQUEST
= self::PREFIX_WORKGROUP .
UserToGroupTable::ROLE_REQUEST
;
18
19
public
const
ROLE_MAP
= [
20
CounterDictionary::ENTITY_WORKGROUP_DETAIL
=> [
21
UserToGroupTable::ROLE_OWNER
=>
self::WORKGROUP_OWNER
,
22
UserToGroupTable::ROLE_MODERATOR
=>
self::WORKGROUP_MODERATOR
,
23
UserToGroupTable::ROLE_USER
=>
self::WORKGROUP_USER
,
24
UserToGroupTable::ROLE_REQUEST
=>
self::WORKGROUP_REQUEST
,
25
],
26
];
27
28
public
static
function
get
(array $params = []): string
29
{
30
$entityType = $params[
'entityType'
] ??
null
;
31
$role = $params[
'role'
] ??
null
;
32
33
if
(
34
empty($entityType)
35
|| empty($role)
36
|| !isset(self::ROLE_MAP[$entityType][$role])
37
)
38
{
39
return
self::ALL
;
40
}
41
42
return
self::ROLE_MAP[$entityType][$role];
43
}
44
45
}
Bitrix\Socialnetwork\Internals\Counter\CounterDictionary\ENTITY_WORKGROUP_DETAIL
const ENTITY_WORKGROUP_DETAIL
Definition
counterdictionary.php:12
Bitrix\Socialnetwork\Internals\Counter\Role
Definition
role.php:8
Bitrix\Socialnetwork\Internals\Counter\Role\WORKGROUP_REQUEST
const WORKGROUP_REQUEST
Definition
role.php:17
Bitrix\Socialnetwork\Internals\Counter\Role\ROLE_MAP
const ROLE_MAP
Definition
role.php:19
Bitrix\Socialnetwork\Internals\Counter\Role\WORKGROUP_MODERATOR
const WORKGROUP_MODERATOR
Definition
role.php:15
Bitrix\Socialnetwork\Internals\Counter\Role\WORKGROUP_USER
const WORKGROUP_USER
Definition
role.php:16
Bitrix\Socialnetwork\Internals\Counter\Role\ENTITY_WORKGROUP
const ENTITY_WORKGROUP
Definition
role.php:9
Bitrix\Socialnetwork\Internals\Counter\Role\PREFIX_WORKGROUP
const PREFIX_WORKGROUP
Definition
role.php:11
Bitrix\Socialnetwork\Internals\Counter\Role\WORKGROUP_OWNER
const WORKGROUP_OWNER
Definition
role.php:14
Bitrix\Socialnetwork\Internals\Counter\Role\ALL
const ALL
Definition
role.php:13
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\ROLE_MODERATOR
const ROLE_MODERATOR
Definition
usertogroup.php:35
Bitrix\Socialnetwork\UserToGroupTable\ROLE_OWNER
const ROLE_OWNER
Definition
usertogroup.php:34
Bitrix\Socialnetwork\Internals\Counter
Definition
countercontroller.php:9
modules
socialnetwork
lib
internals
counter
role.php
Создано системой
1.10.0