1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
role.php
См. документацию.
1<?php
2namespace Bitrix\Landing\PublicAction;
3
4use \Bitrix\Main\Localization\Loc;
5use \Bitrix\Landing\Manager;
6use \Bitrix\Landing\Rights;
7use \Bitrix\Landing\Role as RoleCore;
8use \Bitrix\Landing\PublicActionResult;
9
10Loc::loadMessages(__FILE__);
11
12class Role
13{
18 public static function init()
19 {
20 static $internal = true;
21
23 $error = new \Bitrix\Landing\Error;
24
25 if (!Rights::isAdmin())
26 {
27 $error->addError(
28 'IS_NOT_ADMIN',
29 Loc::getMessage('LANDING_IS_NOT_ADMIN_ERROR')
30 );
31 $result->setError($error);
32 }
34 {
35 $error->addError(
36 'FEATURE_NOT_AVAIL',
37 \Bitrix\Landing\Restriction\Manager::getSystemErrorMessage(
38 'limit_sites_access_permissions'
39 )
40 );
41 $result->setError($error);
42 }
43
44 return $result;
45 }
46
51 public static function getList()
52 {
54
55 $roles = [];
56 foreach (RoleCore::fetchAll() as $item)
57 {
58 $roles[] = [
59 'ID' => $item['ID'],
60 'TITLE' => $item['TITLE'],
61 'XML_ID' => $item['XML_ID']
62 ];
63 }
64
65 $result->setResult($roles);
66
67 return $result;
68 }
69
75 public static function getRights($id)
76 {
77 $id = (int)$id;
79 $result->setResult(
81 );
82 return $result;
83 }
84
92 public static function setRights($id, array $rights, $additional = null)
93 {
94 static $mixedParams = ['additional'];
95
96 $id = (int)$id;
98 $result->setResult(true);
100 $id,
101 $rights,
102 ($additional !== null) ? $additional : null
103 );
104
105 return $result;
106 }
107
114 public static function setAccessCodes($id, array $codes = array())
115 {
117 $result->setResult(true);
118 RoleCore::setAccessCodes((int)$id, $codes);
119 return $result;
120 }
121
126 public static function isEnabled()
127 {
129 $result->setResult(
131 );
132 return $result;
133 }
134
140 public static function enable($mode)
141 {
143 $extended = Rights::isExtendedMode();
144 if (
145 $mode && $extended ||
146 !$mode && !$extended
147 )
148 {
150 }
151 $result->setResult(true);
152 return $result;
153 }
154}
const FEATURE_PERMISSIONS_AVAILABLE
Определения manager.php:42
static checkFeature(string $feature, array $params=array())
Определения manager.php:836
static enable($mode)
Определения role.php:140
static getRights($id)
Определения role.php:75
static setRights($id, array $rights, $additional=null)
Определения role.php:92
static setAccessCodes($id, array $codes=array())
Определения role.php:114
static isEnabled()
Определения role.php:126
static init()
Определения role.php:18
static getList()
Определения role.php:51
static switchMode()
Определения rights.php:799
static isExtendedMode()
Определения rights.php:783
static isAdmin()
Определения rights.php:145
static fetchAll()
Определения role.php:114
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
Определения agent.php:3
$error
Определения subscription_card_product.php:20
$rights
Определения options.php:4