Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
SettingsCheckAccess.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Controller\Filter
;
4
5
use
Bitrix\Im\V2\Entity\User\User
;
6
use
Bitrix\Im\V2\Settings\SettingsError
;
7
use
Bitrix\Main\Engine\ActionFilter\Base
;
8
use
Bitrix\Main\Event
;
9
use
Bitrix\Main\EventResult
;
10
11
class
SettingsCheckAccess
extends
Base
12
{
13
public
function
onBeforeAction
(
Event
$event)
14
{
15
$userId = (int)$this->
getAction
()->getArguments()[
'userId'
];
16
$currentUserId = User::getCurrent()->getId();
17
if
(
18
$userId !== $currentUserId
19
&& !User::getCurrent()->isAdmin()
20
)
21
{
22
$this->
addError
(
new
SettingsError
(
SettingsError::ACCESS_DENIED
));
23
24
return
new
EventResult
(EventResult::ERROR,
null
,
null
, $this);
25
}
26
27
return
null
;
28
}
29
}
Bitrix\Im\V2\Controller\Filter\SettingsCheckAccess
Definition
SettingsCheckAccess.php:12
Bitrix\Im\V2\Controller\Filter\SettingsCheckAccess\onBeforeAction
onBeforeAction(Event $event)
Definition
SettingsCheckAccess.php:13
Bitrix\Im\V2\Entity\User\User
Definition
User.php:24
Bitrix\Im\V2\Settings\SettingsError
Definition
SettingsError.php:9
Bitrix\Im\V2\Settings\SettingsError\ACCESS_DENIED
const ACCESS_DENIED
Definition
SettingsError.php:11
Bitrix\Im\V2\Sync\Event
Definition
Event.php:9
Bitrix\Main\Engine\ActionFilter\Base
Definition
base.php:15
Bitrix\Main\Engine\ActionFilter\Base\addError
addError(Error $error)
Definition
base.php:80
Bitrix\Main\Engine\ActionFilter\Base\getAction
getAction()
Definition
base.php:48
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\EventResult
Definition
eventresult.php:5
Bitrix\Im\V2\Controller\Filter
Definition
ActionUuidHandler.php:3
modules
im
lib
V2
Controller
Filter
SettingsCheckAccess.php
Создано системой
1.10.0