Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
StoreDocumentPerformRule.php
1<?php
2
4
8
10{
16 protected static function getPermissionCode(array $params): ?string
17 {
18 $docCode = $params['value'] ?? null;
19 $docItem = $params['item'] ?? null;
20
21 if ($docItem instanceof StoreDocument)
22 {
23 $docCode = $docItem->getType();
24 }
25
26 if (!$docCode || !in_array($docCode, PermissionDictionary::getAvailableStoreDocuments(), true))
27 {
28 return null;
29 }
30
31 $permissionId = (string)ActionDictionary::getStoreDocumentActionPermissionMap()[$params['action']];
32 if (!$permissionId)
33 {
34 return null;
35 }
36
37 return PermissionDictionary::getStoreDocumentPermissionId($permissionId, $docCode);
38 }
39}