Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
sectioneventviewfullrule.php
1<?php
2
4
7use Bitrix\Calendar\Access\Rule\Traits\ExtranetUserTrait;
10use Bitrix\Calendar\Access\Rule\Traits\CurrentUserTrait;
11use Bitrix\Calendar\Access\Rule\Traits\SectionTrait;
12use CCalendarSect;
13
15{
16 use SectionTrait, CurrentUserTrait, ExtranetUserTrait;
17
18 public function execute(AccessibleItem $item = null, $params = null): bool
19 {
20 if (!$item instanceof SectionModel)
21 {
22 return false;
23 }
24
25 if (!$this->hasCurrentUser())
26 {
27 return true;
28 }
29
30 if (!$this->canSeeOwnerIfExtranetUser($item, $this->user))
31 {
32 return false;
33 }
34
35 if ($this->user->isAdmin() || $this->user->isSocNetAdmin($item->getType()))
36 {
37 return true;
38 }
39
40 if ($this->isOwner($item, $this->user->getUserId()) || $this->isManager($item, $this->user->getUserId()))
41 {
42 return true;
43 }
44
45 $type = TypeModel::createFromSectionModel($item);
46 $typeCheck = true;
47
48 if ($item->getType() !== \Bitrix\Calendar\Core\Event\Tools\Dictionary::CALENDAR_TYPE['resource'])
49 {
50 $typeCheck = $this->controller->check(ActionDictionary::ACTION_TYPE_VIEW, $type);
51 }
52
53 return
54 $typeCheck
55 && in_array(
57 CCalendarSect::GetOperations($item->getId(), $this->user->getUserId()),
58 true
59 );
60 }
61}
static getOldActionKeyByNewActionKey(string $actionId)