Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
role.php
1<?php
2
4
6
7class 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 = [
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}