Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
permission.php
1<?php
2
4
8use Bitrix\Sender\Access\Role\Role;
9
28class 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}
static getConnection($name="")