1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
CheckNotifyGroupAccess.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Controller\Filter;
4
5use Bitrix\Im\V2\Notification\Group\UserGroup\Dto\ConditionDto;
6use Bitrix\Im\V2\Notification\Group\UserGroup\Dto\UserGroupDto;
7use Bitrix\Im\V2\Notification\Group\UserGroup\GroupRepository;
8use Bitrix\Im\V2\Notification\NotifyError;
9use Bitrix\Main\Event;
10use Bitrix\Main\EventResult;
11use Bitrix\Main\Engine\ActionFilter\Base;
12
14{
15 private readonly GroupRepository $groupRepository;
16
17 public function __construct()
18 {
19 parent::__construct();
20 $this->groupRepository = new GroupRepository();
21 }
22
24 {
25 if ($this->isNotFound())
26 {
28
29 return new EventResult(EventResult::ERROR, null, null, $this);
30 }
31
32 return null;
33 }
34
35 private function isNotFound(): bool
36 {
37 foreach ($this->getAction()->getArguments() as $argument)
38 {
39 if ($argument instanceof UserGroupDto || $argument instanceof ConditionDto)
40 {
41 $exists = $this->groupRepository->isExistsWithUserId($argument->groupId, $argument->userId);
42
43 return $exists === false;
44 }
45 }
46
47 return false;
48 }
49}
addError(Error $error)
Определения base.php:80
$event
Определения prolog_after.php:141