Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
RoleRelationService.php
1<?php
3
8
10{
15 public function saveRoleRelation(array $settings): void
16 {
17 foreach ($settings as $setting)
18 {
19 $roleId = $setting['id'];
20 $accessCodes = $setting['accessCodes'] ?? [];
21
22 if($roleId === false)
23 {
24 continue;
25 }
26
27 (new RoleUtil($roleId))->updateRoleRelations($accessCodes);
28 }
29 }
30
34 public function getRolesByRelations(array $relations): ?array
35 {
36 $senderRoleRelations = RoleRelationTable::query()
37 ->setSelect(['ROLE_ID'])
38 ->whereIn('RELATION', $relations)
39 ->exec()
40 ->fetchAll();
41
42 $roles = [];
43 foreach($senderRoleRelations as $relation)
44 {
45 $roles[] = $relation["ROLE_ID"];
46 }
47
48 return $roles;
49 }
50
55 public function deleteRoleRelations(int $roleId): void
56 {
57 if (!RoleRelationTable::deleteList(["=ROLE_ID" => $roleId]))
58 {
59 throw new SqlQueryException();
60 }
61 }
62
66 public function getRelationList(array $parameters = []): ?array
67 {
68 return RoleRelationTable::getList($parameters)->fetchAll();
69 }
70}