1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
iblockright.php
См. документацию.
1
<?
2
namespace
Bitrix\Lists\Security;
3
4
use Bitrix\Main\Error;
5
use Bitrix\Main\Errorable;
6
use Bitrix\Main\ErrorCollection;
7
use Bitrix\Main\ErrorableImplementation;
8
9
class
IblockRight
implements
RightEntity
,
Errorable
10
{
11
use
ErrorableImplementation
;
12
13
const
ACCESS_DENIED
=
"ACCESS_DENIED"
;
14
15
const
READ
=
"canRead"
;
16
const
EDIT
=
"canEdit"
;
17
18
private
$listsPermission;
19
private
$rightParam;
20
21
public
function
__construct
(
RightParam
$rightParam)
22
{
23
$this->rightParam = $rightParam;
24
25
$this->errorCollection =
new
ErrorCollection
;
26
}
27
33
public
function
setListsPermission
($listsPermission)
34
{
35
$this->listsPermission = $listsPermission;
36
}
37
43
public
function
canRead
()
44
{
45
if
(
46
$this->listsPermission < \
CListPermissions::CAN_READ
47
&& !(
48
\CIBlockRights::userHasRightTo(
49
$this->rightParam->getIblockId(),
50
$this->rightParam->getIblockId(),
51
'element_read'
52
)
53
)
54
)
55
{
56
$this->errorCollection->setError(
new
Error
(
'Access denied'
, self::ACCESS_DENIED));
57
58
return
false
;
59
}
60
61
return
true
;
62
}
63
69
public
function
canEdit
()
70
{
71
if
(
72
(
73
$this->rightParam->getIblockId() &&
74
$this->listsPermission < \
CListPermissions::IS_ADMIN
&&
75
!\CIBlockRights::userHasRightTo(
76
$this->rightParam->getIblockId(), $this->rightParam->getIblockId(),
"iblock_edit"
)
77
) ||
78
(
79
!$this->rightParam->getIblockId() && $this->listsPermission < \
CListPermissions::IS_ADMIN
80
)
81
)
82
{
83
$this->errorCollection->setError(
new
Error
(
"Access denied"
, self::ACCESS_DENIED));
84
return
false
;
85
}
86
return
true
;
87
}
88
}
Bitrix\Lists\Security\IblockRight
Определения
iblockright.php:10
Bitrix\Lists\Security\IblockRight\setListsPermission
setListsPermission($listsPermission)
Определения
iblockright.php:33
Bitrix\Lists\Security\IblockRight\ACCESS_DENIED
const ACCESS_DENIED
Определения
iblockright.php:13
Bitrix\Lists\Security\IblockRight\canRead
canRead()
Определения
iblockright.php:43
Bitrix\Lists\Security\IblockRight\canEdit
canEdit()
Определения
iblockright.php:69
Bitrix\Lists\Security\IblockRight\__construct
__construct(RightParam $rightParam)
Определения
iblockright.php:21
Bitrix\Lists\Security\IblockRight\EDIT
const EDIT
Определения
iblockright.php:16
Bitrix\Lists\Security\IblockRight\READ
const READ
Определения
iblockright.php:15
Bitrix\Lists\Security\RightParam
Определения
rightparam.php:11
Bitrix\Main\ErrorCollection
Определения
errorcollection.php:14
Bitrix\Main\Error
Определения
error.php:15
CListPermissions\CAN_READ
const CAN_READ
Определения
listperm.php:11
CListPermissions\IS_ADMIN
const IS_ADMIN
Определения
listperm.php:14
Bitrix\Lists\Security\RightEntity
Определения
rightentity.php:5
Bitrix\Main\Errorable
Определения
errorable.php:6
Bitrix\Main\ErrorableImplementation
trait ErrorableImplementation
Определения
errorableimplementation.php:8
bitrix
modules
lists
lib
security
iblockright.php
Создано системой
1.14.0