1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
RoleRelationService.php
См. документацию.
1<?php
2namespace Bitrix\Catalog\Access\Service;
3
4use Bitrix\Main\Access\Exception\RoleRelationSaveException;
5use Bitrix\Main\DB\SqlQueryException;
6use Bitrix\Catalog\Access\Role\RoleRelationTable;
7use Bitrix\Catalog\Access\Role\RoleUtil;
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}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$settings
Определения product_settings.php:43