Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
CheckChatCanPost.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Controller\Filter
;
4
5
use
Bitrix\Im\V2\Chat
;
6
use
Bitrix\Im\V2\Chat\ChatError
;
7
use
Bitrix\Main\Engine\ActionFilter\Base
;
8
use
Bitrix\Main\Engine\Response\Converter
;
9
use
Bitrix\Main\Event
;
10
use
Bitrix\Main\EventResult
;
11
12
class
CheckChatCanPost
extends
Base
13
{
14
public
function
onBeforeAction
(
Event
$event)
15
{
16
$arguments = $this->
getAction
()->getArguments();
17
$arguments[
'rightsLevel'
] = (
new
Converter
(Converter::TO_UPPER))->process($arguments[
'rightsLevel'
] ??
''
);
18
$this->
getAction
()->setArguments($arguments);
19
if
(in_array(
20
$arguments[
'rightsLevel'
],
21
[
Chat::MANAGE_RIGHTS_NONE
,
Chat::MANAGE_RIGHTS_MEMBER
,
Chat::MANAGE_RIGHTS_MANAGERS
,
Chat::MANAGE_RIGHTS_OWNER
],
22
true
23
))
24
{
25
return
null
;
26
}
27
28
$this->
addError
(
new
ChatError
(
29
ChatError::WRONG_PARAMETER
30
));
31
return
new
EventResult
(EventResult::ERROR,
null
,
null
, $this);
32
}
33
}
Bitrix\Im\V2\Chat\ChatError
Definition
ChatError.php:9
Bitrix\Im\V2\Chat\ChatError\WRONG_PARAMETER
const WRONG_PARAMETER
Definition
ChatError.php:12
Bitrix\Im\V2\Chat\MANAGE_RIGHTS_MEMBER
const MANAGE_RIGHTS_MEMBER
Definition
Chat.php:133
Bitrix\Im\V2\Chat\MANAGE_RIGHTS_MANAGERS
const MANAGE_RIGHTS_MANAGERS
Definition
Chat.php:135
Bitrix\Im\V2\Chat\MANAGE_RIGHTS_NONE
const MANAGE_RIGHTS_NONE
Definition
Chat.php:132
Bitrix\Im\V2\Chat\MANAGE_RIGHTS_OWNER
const MANAGE_RIGHTS_OWNER
Definition
Chat.php:134
Bitrix\Im\V2\Controller\Filter\CheckChatCanPost
Definition
CheckChatCanPost.php:13
Bitrix\Im\V2\Controller\Filter\CheckChatCanPost\onBeforeAction
onBeforeAction(Event $event)
Definition
CheckChatCanPost.php:14
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\Engine\Response\Converter
Definition
converter.php:8
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\EventResult
Definition
eventresult.php:5
Bitrix\Im\V2\Chat
Definition
ChannelChat.php:3
Bitrix\Im\V2\Controller\Filter
Definition
ActionUuidHandler.php:3
modules
im
lib
V2
Controller
Filter
CheckChatCanPost.php
Создано системой
1.10.0