Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
permission.php
1
<?php
2
3
namespace
Bitrix\Sender\Internals\Model\Role
;
4
5
use
Bitrix\Main\Application
;
6
use
Bitrix\Main\ArgumentException
;
7
use
Bitrix\Main\Entity
;
8
use Bitrix\Sender\Access\Role\Role;
9
28
class
PermissionTable
extends
Entity\DataManager
29
{
36
public
static
function
getTableName
()
37
{
38
return
'b_sender_role_permission'
;
39
}
40
47
public
static
function
getMap
()
48
{
49
return
array(
50
'ID'
=>
new
Entity
\
IntegerField
(
'ID'
, array(
51
'primary'
=>
true
,
52
'autocomplete'
=>
true
,
53
)),
54
'ROLE_ID'
=>
new
Entity
\
IntegerField
(
'ROLE_ID'
, array(
55
'required'
=>
true
,
56
)),
57
'ENTITY'
=>
new
Entity
\
StringField
(
'ENTITY'
, array(
58
'required'
=>
true
,
59
)),
60
'ACTION'
=>
new
Entity
\
StringField
(
'ACTION'
, array(
61
'required'
=>
true
,
62
)),
63
'PERMISSION'
=>
new
Entity
\
StringField
(
'PERMISSION'
),
64
'ROLE_ACCESS'
=>
new
Entity
\ReferenceField(
65
'ROLE_ACCESS'
,
66
'Bitrix\Sender\Internals\Model\Role\Access'
,
67
array(
'=this.ROLE_ID'
=>
'ref.ROLE_ID'
),
68
array(
'join_type'
=>
'INNER'
)
69
),
70
'ROLE'
=>
new
Entity
\ReferenceField(
71
'ROLE'
,
'Bitrix\Sender\Access\Role\Role'
,
72
array(
'=this.ROLE_ID'
=>
'ref.ID'
),
73
array(
'join_type'
=>
'INNER'
)
74
),
75
);
76
}
77
85
public
static
function
deleteByRoleId
($roleId)
86
{
87
$roleId = (int) $roleId;
88
if
($roleId <= 0)
89
{
90
throw
new
ArgumentException
(
'Role id should be greater than zero'
,
'roleId'
);
91
}
92
93
$sql =
"DELETE FROM "
.
self::getTableName
() .
" WHERE ROLE_ID = "
. $roleId;
94
Application::getConnection
()->queryExecute($sql);
95
96
$result =
new
Entity\DeleteResult
();
97
return
$result;
98
}
99
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Main\ORM\Data\DeleteResult
Definition
deleteresult.php:12
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Sender\Internals\Model\Role\PermissionTable
Definition
permission.php:29
Bitrix\Sender\Internals\Model\Role\PermissionTable\deleteByRoleId
static deleteByRoleId($roleId)
Definition
permission.php:85
Bitrix\Sender\Internals\Model\Role\PermissionTable\getMap
static getMap()
Definition
permission.php:47
Bitrix\Sender\Internals\Model\Role\PermissionTable\getTableName
static getTableName()
Definition
permission.php:36
Bitrix\Sender\Internals\Model\Role
Definition
access.php:3
modules
sender
lib
internals
model
role
permission.php
Создано системой
1.10.0