Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
actiondictionary.php
1<?php
10
14
15Loc::loadMessages(__FILE__);
16
18{
19 const ACTION_MAILING_VIEW = 'mailing_view';
20 const ACTION_MAILING_EMAIL_EDIT = 'mailing_email_edit';
21 const ACTION_MAILING_SMS_EDIT = 'mailing_sms_edit';
22 const ACTION_MAILING_MESSENGER_EDIT = 'mailing_messenger_edit';
23 const ACTION_MAILING_INFO_CALL_EDIT = 'mailing_info_call_edit';
24 const ACTION_MAILING_AUDIO_CALL_EDIT = 'mailing_audio_call_edit';
25 const ACTION_MAILING_PAUSE_START_STOP = 'mailing_pause_start_stop';
26 const ACTION_MAILING_CLIENT_VIEW = 'mailing_client_view';
27
28 const ACTION_ADS_VIEW = 'ads_view';
29 const ACTION_ADS_YANDEX_EDIT = 'ads_yandex_edit';
30 const ACTION_ADS_GOOGLE_EDIT = 'ads_google_edit_msgver_1';
31 const ACTION_ADS_VK_EDIT = 'ads_vk_edit';
32 const ACTION_ADS_FB_INSTAGRAM_EDIT = 'ads_fb_instagram_edit';
33 const ACTION_ADS_LOOK_ALIKE_VK_EDIT = 'ads_look_alike_vk_edit';
34 const ACTION_ADS_LOOK_ALIKE_FB_EDIT = 'ads_look_alike_fb_edit';
35 public const ACTION_ADS_LOOK_ALIKE_YANDEX_EDIT = 'ads_look_alike_ya_edit';
36 const ACTION_ADS_PAUSE_START_STOP = 'ads_pause_start_stop';
37 const ACTION_ADS_CLIENT_VIEW = 'ads_client_view';
38 const ACTION_ADS_CONNECT_CABINET = 'ads_connect_cabinet';
39 public const ACTION_ADS_MASTER_YANDEX_VIEW = 'ads_master_yandex';
40
41 const ACTION_RC_EDIT = 'rc_edit';
42 const ACTION_RC_VIEW = 'rc_view';
43 const ACTION_RC_PAUSE_START_STOP = 'rc_pause_start_stop';
44
45 const ACTION_SEGMENT_EDIT = 'segment_edit';
46 const ACTION_SEGMENT_VIEW = 'segment_view ';
47 const ACTION_SEGMENT_CLIENT_EDIT = 'segment_client_edit';
48 const ACTION_SEGMENT_CLIENT_VIEW = 'segment_client_view';
49 const ACTION_SEGMENT_CLIENT_OWN_CATEGORY = 'segment_client_own_category';
50 const ACTION_SEGMENT_LEAD_EDIT = 'segment_lead_edit';
51 const ACTION_SEGMENT_CLIENT_PERSONAL_EDIT = 'segment_client_personal_edit';
52
53 const ACTION_BLACKLIST_EDIT = 'blacklist_edit';
54 const ACTION_BLACKLIST_VIEW = 'blacklist_view';
55
56 const ACTION_TEMPLATE_EDIT = 'template_edit';
57 const ACTION_TEMPLATE_VIEW = 'template_view';
58
59 const ACTION_START_VIEW = 'start_view';
60
61 const ACTION_SETTINGS_EDIT = 'settings_edit';
62// const ACTION_SETTINGS_VIEW = 'settings_view';
63 const ACTION_ADS_MARKETING_FB_EDIT = 'ads_marketing_fb_edit';
64 const ACTION_ADS_MARKETING_INSTAGRAM_EDIT = 'ads_marketing_instagram_edit';
65
66 public const PREFIX="ACTION_";
67
68 protected static function getClassName()
69 {
70 return __CLASS__;
71 }
72
77 public static function getActionPermissionMap()
78 {
79 return [
80 self::ACTION_MAILING_VIEW => PermissionDictionary::MAILING_VIEW,
81 self::ACTION_MAILING_EMAIL_EDIT => PermissionDictionary::MAILING_EMAIL_EDIT,
82 self::ACTION_MAILING_SMS_EDIT => PermissionDictionary::MAILING_SMS_EDIT,
83 self::ACTION_MAILING_MESSENGER_EDIT => PermissionDictionary::MAILING_MESSENGER_EDIT,
84 self::ACTION_MAILING_INFO_CALL_EDIT => PermissionDictionary::MAILING_INFO_CALL_EDIT,
85 self::ACTION_MAILING_AUDIO_CALL_EDIT => PermissionDictionary::MAILING_AUDIO_CALL_EDIT,
86 self::ACTION_MAILING_CLIENT_VIEW => PermissionDictionary::MAILING_CLIENT_VIEW,
87 self::ACTION_ADS_VIEW => PermissionDictionary::ADS_VIEW,
88 self::ACTION_ADS_YANDEX_EDIT => PermissionDictionary::ADS_YANDEX_EDIT,
89 self::ACTION_ADS_GOOGLE_EDIT => PermissionDictionary::ADS_GOOGLE_EDIT_MSGVER_1,
90 self::ACTION_ADS_VK_EDIT => PermissionDictionary::ADS_VK_EDIT,
91 self::ACTION_ADS_MARKETING_FB_EDIT => PermissionDictionary::ADS_MARKETING_FB_EDIT,
92 self::ACTION_ADS_MARKETING_INSTAGRAM_EDIT => PermissionDictionary::ADS_MARKETING_INSTAGRAM_EDIT,
93 self::ACTION_ADS_FB_INSTAGRAM_EDIT => PermissionDictionary::ADS_FB_INSTAGRAM_EDIT,
94 self::ACTION_ADS_LOOK_ALIKE_VK_EDIT => PermissionDictionary::ADS_LOOK_ALIKE_VK_EDIT,
95 self::ACTION_ADS_LOOK_ALIKE_YANDEX_EDIT => PermissionDictionary::ADS_LOOK_ALIKE_YA_EDIT,
96 self::ACTION_ADS_LOOK_ALIKE_FB_EDIT => PermissionDictionary::ADS_LOOK_ALIKE_FB_EDIT,
97 self::ACTION_ADS_MASTER_YANDEX_VIEW => PermissionDictionary::ADS_MASTER_YANDEX_EDIT,
98 self::ACTION_ADS_CLIENT_VIEW => PermissionDictionary::ADS_CLIENT_VIEW,
99 self::ACTION_ADS_CONNECT_CABINET => PermissionDictionary::ADS_CONNECT_CABINET,
100 self::ACTION_SEGMENT_EDIT => PermissionDictionary::SEGMENT_EDIT,
101 self::ACTION_SEGMENT_VIEW => PermissionDictionary::SEGMENT_VIEW,
102 self::ACTION_SEGMENT_CLIENT_OWN_CATEGORY => PermissionDictionary::SEGMENT_CLIENT_OWN_CATEGORY,
103 self::ACTION_SEGMENT_CLIENT_EDIT => PermissionDictionary::SEGMENT_CLIENT_EDIT,
104 self::ACTION_SEGMENT_CLIENT_VIEW => PermissionDictionary::SEGMENT_CLIENT_VIEW,
105 self::ACTION_SEGMENT_LEAD_EDIT => PermissionDictionary::SEGMENT_LEAD_EDIT,
106 self::ACTION_SEGMENT_CLIENT_PERSONAL_EDIT => PermissionDictionary::SEGMENT_CLIENT_PERSONAL_EDIT,
107 self::ACTION_RC_EDIT => PermissionDictionary::RC_EDIT,
108 self::ACTION_RC_PAUSE_START_STOP => PermissionDictionary::RC_PAUSE_START_STOP,
109 self::ACTION_RC_VIEW => PermissionDictionary::RC_VIEW,
110 self::ACTION_BLACKLIST_EDIT => PermissionDictionary::BLACKLIST_EDIT,
111 self::ACTION_BLACKLIST_VIEW => PermissionDictionary::BLACKLIST_VIEW,
112 self::ACTION_TEMPLATE_EDIT => PermissionDictionary::TEMPLATE_EDIT,
113 self::ACTION_TEMPLATE_VIEW => PermissionDictionary::TEMPLATE_VIEW,
114 self::ACTION_START_VIEW => PermissionDictionary::START_VIEW,
115 self::ACTION_SETTINGS_EDIT => PermissionDictionary::SETTINGS_EDIT,
116// self::ACTION_SETTINGS_VIEW => PermissionDictionary::SETTINGS_VIEW,
117 self::ACTION_MAILING_PAUSE_START_STOP => PermissionDictionary::MAILING_PAUSE_START_STOP,
118 self::ACTION_ADS_PAUSE_START_STOP => PermissionDictionary::ADS_PAUSE_START_STOP
119 ];
120 }
121
126 public static function getLegacyMap()
127 {
128 return[
129 self::ACTION_MAILING_VIEW => Permission::ACTION_VIEW,
130 self::ACTION_MAILING_EMAIL_EDIT => Permission::ACTION_MODIFY,
131 self::ACTION_MAILING_PAUSE_START_STOP => Permission::ACTION_MODIFY,
132 self::ACTION_ADS_PAUSE_START_STOP => Permission::ACTION_MODIFY,
133 self::ACTION_MAILING_SMS_EDIT => Permission::ACTION_MODIFY,
134 self::ACTION_MAILING_MESSENGER_EDIT => Permission::ACTION_MODIFY,
135 self::ACTION_MAILING_INFO_CALL_EDIT => Permission::ACTION_MODIFY,
136 self::ACTION_MAILING_AUDIO_CALL_EDIT => Permission::ACTION_MODIFY,
137 self::ACTION_ADS_VIEW => Permission::ACTION_VIEW,
138 self::ACTION_ADS_YANDEX_EDIT => Permission::ACTION_MODIFY,
139 self::ACTION_ADS_GOOGLE_EDIT => Permission::ACTION_MODIFY,
140 self::ACTION_ADS_VK_EDIT => Permission::ACTION_MODIFY,
141 self::ACTION_ADS_MARKETING_INSTAGRAM_EDIT => Permission::ACTION_MODIFY,
142 self::ACTION_ADS_MARKETING_FB_EDIT => Permission::ACTION_MODIFY,
143 self::ACTION_ADS_FB_INSTAGRAM_EDIT => Permission::ACTION_MODIFY,
144 self::ACTION_ADS_LOOK_ALIKE_VK_EDIT => Permission::ACTION_MODIFY,
145 self::ACTION_ADS_LOOK_ALIKE_YANDEX_EDIT => Permission::ACTION_MODIFY,
146 self::ACTION_ADS_LOOK_ALIKE_FB_EDIT => Permission::ACTION_MODIFY,
147 self::ACTION_ADS_MASTER_YANDEX_VIEW => Permission::ACTION_VIEW,
148 self::ACTION_SEGMENT_EDIT => Permission::ACTION_MODIFY,
149 self::ACTION_SEGMENT_VIEW => Permission::ACTION_VIEW,
150 self::ACTION_SEGMENT_CLIENT_EDIT => Permission::ACTION_MODIFY,
151 self::ACTION_SEGMENT_CLIENT_OWN_CATEGORY => Permission::ACTION_MODIFY,
152 self::ACTION_SEGMENT_CLIENT_VIEW => Permission::ACTION_VIEW,
153 self::ACTION_SEGMENT_LEAD_EDIT => Permission::ACTION_MODIFY,
154 self::ACTION_SEGMENT_CLIENT_PERSONAL_EDIT => Permission::ACTION_MODIFY,
155 self::ACTION_RC_EDIT => Permission::ACTION_MODIFY,
156 self::ACTION_RC_VIEW => Permission::ACTION_VIEW,
157 self::ACTION_BLACKLIST_EDIT => Permission::ACTION_MODIFY,
158 self::ACTION_BLACKLIST_VIEW => Permission::ACTION_VIEW,
159 self::ACTION_TEMPLATE_EDIT => Permission::ACTION_MODIFY,
160 self::ACTION_TEMPLATE_VIEW => Permission::ACTION_VIEW,
161 self::ACTION_START_VIEW => Permission::ACTION_VIEW,
162 self::ACTION_SETTINGS_EDIT => Permission::ACTION_MODIFY,
163// self::ACTION_SETTINGS_VIEW => Permission::ACTION_MODIFY,
164 ];
165 }
166
174 public static function getActionName(string $value): ?string
175 {
176 $constants = self::getActionNames();
177 if (!array_key_exists($value, $constants))
178 {
179 return null;
180 }
181
182 return str_replace(self::PREFIX, '', $constants[$value]);
183 }
184
189 private static function getActionNames(): array
190 {
191 $class = new \ReflectionClass(__CLASS__);
192 $constants = $class->getConstants();
193 foreach ($constants as $name => $value)
194 {
195 if (strpos($name, self::PREFIX) !== 0)
196 {
197 unset($constants[$name]);
198 }
199 }
200
201 return array_flip($constants);
202 }
203}
static loadMessages($file)
Definition loc.php:64