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