Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
eventeditrule.php
1<?php
2
4
7use Bitrix\Calendar\Access\Rule\Traits\SharingTrait;
11use Bitrix\Calendar\Access\Rule\Traits\CurrentUserTrait;
12
14{
15 use CurrentUserTrait;
16 use SharingTrait;
17
18 public function execute(AccessibleItem $item = null, $params = null): bool
19 {
20 if (!$item instanceof EventModel)
21 {
22 return false;
23 }
24
25 if (!$this->hasCurrentUser())
26 {
27 return true;
28 }
29
30 if ($this->user->isAdmin() || $this->user->isSocNetAdmin($item->getSectionType()))
31 {
32 return true;
33 }
34
35 $doCheckCurrentEvent = isset($params['checkCurrentEvent']) && $params['checkCurrentEvent'] === 'Y';
36 $isSharingEventLinkOwner =
37 in_array($item->getEventType(), SharingEventManager::getSharingEventTypes())
38 && $this->isEventLinkOwner($item->getParentEventId(), $this->user->getUserId())
39 ;
40
41 if ($doCheckCurrentEvent || $isSharingEventLinkOwner)
42 {
43 $section = SectionModel::createFromEventModel($item);
44 }
45 else
46 {
47 $section = SectionModel::createFromEventModelParentFields($item);
48 }
49
50 return $this->controller->check(
52 $section,
53 );
54 }
55}
execute(AccessibleItem $item=null, $params=null)