Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
sectionright.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
SectionRight
implements
RightEntity
,
Errorable
10
{
11
use
ErrorableImplementation
;
12
13
const
ACCESS_DENIED
=
"ACCESS_DENIED"
;
14
15
const
ADD
=
"canAdd"
;
16
const
READ
=
"canRead"
;
17
const
EDIT
=
"canEdit"
;
18
const
DELETE
=
"canDelete"
;
19
20
private
$listsPermission;
21
private
$rightParam;
22
private
$socnetGroupClosed =
false
;
23
24
public
function
__construct
(
RightParam
$rightParam)
25
{
26
$this->rightParam = $rightParam;
27
28
$this->socnetGroupClosed = $this->rightParam->
getClosedStatusSocnetGroup
();
29
30
$this->errorCollection =
new
ErrorCollection
;
31
}
32
38
public
function
setListsPermission
($listsPermission)
39
{
40
$this->listsPermission = $listsPermission;
41
}
42
48
public
function
canRead
()
49
{
50
if
(
51
$this->listsPermission < \CListPermissions::CAN_WRITE &&
52
!\CIBlockSectionRights::userHasRightTo(
53
$this->rightParam->getIblockId(), $this->rightParam->getEntityId(),
"section_read"
)
54
)
55
{
56
$this->errorCollection->setError(
new
Error
(
"Access denied"
, self::ACCESS_DENIED));
57
return
false
;
58
}
59
return
true
;
60
}
61
67
public
function
canEdit
()
68
{
69
$canEdit = (
70
!$this->socnetGroupClosed &&
71
(
72
($this->listsPermission >= \CListPermissions::CAN_WRITE) ||
73
\CIBlockSectionRights::userHasRightTo(
74
$this->rightParam->getIblockId(), $this->rightParam->getEntityId(),
"section_edit"
)
75
)
76
);
77
78
if
($canEdit)
79
{
80
return
true
;
81
}
82
else
83
{
84
$this->errorCollection->setError(
new
Error
(
"Access denied"
, self::ACCESS_DENIED));
85
return
false
;
86
}
87
}
88
94
public
function
canAdd
()
95
{
96
$canAdd = (
97
!$this->socnetGroupClosed &&
98
(
99
($this->listsPermission >= \CListPermissions::CAN_WRITE) ||
100
\CIBlockSectionRights::userHasRightTo(
101
$this->rightParam->getIblockId(), $this->rightParam->getEntityId(),
"section_section_bind"
)
102
)
103
);
104
105
if
($canAdd)
106
{
107
return
true
;
108
}
109
else
110
{
111
$this->errorCollection->setError(
new
Error
(
"Access denied"
, self::ACCESS_DENIED));
112
return
false
;
113
}
114
}
115
121
public
function
canDelete
()
122
{
123
$canDelete = (
124
!$this->socnetGroupClosed &&
125
(
126
($this->listsPermission >= \CListPermissions::CAN_WRITE) ||
127
\CIBlockSectionRights::userHasRightTo(
128
$this->rightParam->getIblockId(), $this->rightParam->getEntityId(),
"section_delete"
)
129
)
130
);
131
132
if
($canDelete)
133
{
134
return
true
;
135
}
136
else
137
{
138
$this->errorCollection->setError(
new
Error
(
"Access denied"
, self::ACCESS_DENIED));
139
return
false
;
140
}
141
}
142
}
Bitrix\Lists\Security\RightParam
Definition
rightparam.php:11
Bitrix\Lists\Security\RightParam\getClosedStatusSocnetGroup
getClosedStatusSocnetGroup()
Definition
rightparam.php:136
Bitrix\Lists\Security\SectionRight
Definition
sectionright.php:10
Bitrix\Lists\Security\SectionRight\canDelete
canDelete()
Definition
sectionright.php:121
Bitrix\Lists\Security\SectionRight\ADD
const ADD
Definition
sectionright.php:15
Bitrix\Lists\Security\SectionRight\setListsPermission
setListsPermission($listsPermission)
Definition
sectionright.php:38
Bitrix\Lists\Security\SectionRight\ACCESS_DENIED
const ACCESS_DENIED
Definition
sectionright.php:13
Bitrix\Lists\Security\SectionRight\DELETE
const DELETE
Definition
sectionright.php:18
Bitrix\Lists\Security\SectionRight\canAdd
canAdd()
Definition
sectionright.php:94
Bitrix\Lists\Security\SectionRight\canRead
canRead()
Definition
sectionright.php:48
Bitrix\Lists\Security\SectionRight\canEdit
canEdit()
Definition
sectionright.php:67
Bitrix\Lists\Security\SectionRight\__construct
__construct(RightParam $rightParam)
Definition
sectionright.php:24
Bitrix\Lists\Security\SectionRight\EDIT
const EDIT
Definition
sectionright.php:17
Bitrix\Lists\Security\SectionRight\READ
const READ
Definition
sectionright.php:16
Bitrix\Main\ErrorCollection
Definition
errorcollection.php:14
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Lists\Security\RightEntity
Definition
rightentity.php:5
Bitrix\Main\Errorable
Definition
errorable.php:6
Bitrix\Lists\Security
Definition
elementright.php:3
Bitrix\Main\ErrorableImplementation
trait ErrorableImplementation
Definition
errorableimplementation.php:8
modules
lists
lib
security
sectionright.php
Создано системой
1.10.0