Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
accessinstaller.php
1<?php
3
7
9{
14 public static function installAgent()
15 {
16 self::fillSystemPermissions();
17 return '';
18 }
19
23 private static function fillSystemPermissions() :void
24 {
26
27 $query = [];
28 try
29 {
30 $oldRolesList = RoleTable::getList(['select' => ['ID', 'XML_ID']])->fetchAll();
31 $xmlIds = array_flip(array_column($oldRolesList, 'XML_ID'));
32 foreach ($map as $roleKey => $permissions)
33 {
34 $roleName = RoleUtil::getLocalizedName($roleKey);
35
36 $roleId = isset($xmlIds[$roleKey])
37 ? $oldRolesList[$xmlIds[$roleKey]]['ID']
38 : (new RolePermissionService())->saveRole($roleName);
39
40 $query = array_merge($query, RoleUtil::buildInsertPermissionQuery($permissions, $roleId));
41 }
42
44 } catch (\Exception $e)
45 {
46 }
47 }
48}
static getLocalizedName(string $key)
Definition roleutil.php:198
static buildInsertPermissionQuery(array $permissions, int $roleId)
Definition roleutil.php:161
static insertPermissions(array $valuesData)
Definition roleutil.php:183