Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
role.php
1
<?php
2
namespace
Bitrix\Landing\PublicAction
;
3
4
use \Bitrix\Main\Localization\Loc;
5
use \Bitrix\Landing\Manager;
6
use \Bitrix\Landing\Rights;
7
use \Bitrix\Landing\Role as RoleCore;
8
use \Bitrix\Landing\PublicActionResult;
9
10
Loc::loadMessages
(__FILE__);
11
12
class
Role
13
{
18
public
static
function
init
()
19
{
20
static
$internal =
true
;
21
22
$result =
new
PublicActionResult
();
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
}
33
else
if
(!
Manager::checkFeature
(
Manager::FEATURE_PERMISSIONS_AVAILABLE
))
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
{
53
$result =
new
PublicActionResult
();
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;
78
$result =
new
PublicActionResult
();
79
$result->setResult(
80
RoleCore::getRights
($id)
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;
97
$result =
new
PublicActionResult
();
98
$result->setResult(
true
);
99
RoleCore::setRights
(
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
{
116
$result =
new
PublicActionResult
();
117
$result->setResult(
true
);
118
RoleCore::setAccessCodes
((
int
)$id, $codes);
119
return
$result;
120
}
121
126
public
static
function
isEnabled
()
127
{
128
$result =
new
PublicActionResult
();
129
$result->setResult(
130
!
Rights::isExtendedMode
()
131
);
132
return
$result;
133
}
134
140
public
static
function
enable
($mode)
141
{
142
$result =
new
PublicActionResult
();
143
$extended =
Rights::isExtendedMode
();
144
if
(
145
$mode && $extended ||
146
!$mode && !$extended
147
)
148
{
149
Rights::switchMode
();
150
}
151
$result->setResult(
true
);
152
return
$result;
153
}
154
}
Bitrix\Landing\Connector\Landing
Definition
landing.php:12
Bitrix\Landing\Manager\FEATURE_PERMISSIONS_AVAILABLE
const FEATURE_PERMISSIONS_AVAILABLE
Definition
manager.php:42
Bitrix\Landing\Manager\checkFeature
static checkFeature(string $feature, array $params=array())
Definition
manager.php:831
Bitrix\Landing\PublicAction\Role
Definition
role.php:13
Bitrix\Landing\PublicAction\Role\enable
static enable($mode)
Definition
role.php:140
Bitrix\Landing\PublicAction\Role\getRights
static getRights($id)
Definition
role.php:75
Bitrix\Landing\PublicAction\Role\setRights
static setRights($id, array $rights, $additional=null)
Definition
role.php:92
Bitrix\Landing\PublicAction\Role\setAccessCodes
static setAccessCodes($id, array $codes=array())
Definition
role.php:114
Bitrix\Landing\PublicAction\Role\isEnabled
static isEnabled()
Definition
role.php:126
Bitrix\Landing\PublicAction\Role\init
static init()
Definition
role.php:18
Bitrix\Landing\PublicAction\Role\getList
static getList()
Definition
role.php:51
Bitrix\Landing\PublicActionResult
Definition
publicactionresult.php:5
Bitrix\Landing\Rights\switchMode
static switchMode()
Definition
rights.php:797
Bitrix\Landing\Rights\isExtendedMode
static isExtendedMode()
Definition
rights.php:781
Bitrix\Landing\Rights\isAdmin
static isAdmin()
Definition
rights.php:143
Bitrix\Landing\Role\setRights
static setRights($roleId, $rights=[], $additionalRights=null)
Definition
role.php:406
Bitrix\Landing\Role\setAccessCodes
static setAccessCodes($roleId, array $codes=array())
Definition
role.php:336
Bitrix\Landing\Role\fetchAll
static fetchAll()
Definition
role.php:114
Bitrix\Landing\Role\getRights
static getRights($roleId)
Definition
role.php:362
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Landing\PublicAction
Definition
block.php:2
Bitrix
modules
landing
lib
publicaction
role.php
Создано системой
1.10.0