1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
eventeditrule.php
См. документацию.
1<?php
2
3namespace Bitrix\Calendar\Access\Rule;
4
5use Bitrix\Calendar\Access\Model\EventModel;
6use Bitrix\Calendar\Access\Model\SectionModel;
7use Bitrix\Calendar\Access\Rule\Traits\CollabTrait;
8use Bitrix\Calendar\Access\Rule\Traits\SharingTrait;
9use Bitrix\Calendar\Core\Event\Tools\Dictionary;
10use Bitrix\Calendar\Sharing\SharingEventManager;
11use Bitrix\Main\Access\AccessibleItem;
12use Bitrix\Calendar\Access\ActionDictionary;
13use Bitrix\Calendar\Access\Rule\Traits\CurrentUserTrait;
14
16{
17 use CurrentUserTrait;
18 use SharingTrait;
19 use CollabTrait;
20
21 public function execute(AccessibleItem $item = null, $params = null): bool
22 {
23 if (!$item instanceof EventModel)
24 {
25 return false;
26 }
27
28 if (!$this->hasCurrentUser())
29 {
30 return true;
31 }
32
33 if ($this->user->isAdmin() || $this->user->isSocNetAdmin($item->getSectionType()))
34 {
35 return true;
36 }
37
38 // for open events skip section check
39 // only creator can edit open events
40 if ($item->getSectionType() === Dictionary::CALENDAR_TYPE['open_event'])
41 {
42 return $this->user->getUserId() === $item->getCreatedBy();
43 }
44
45 if (!$this->isCollaberHasEditAccess($item, $this->user->getUserId()))
46 {
47 return false;
48 }
49
50 $doCheckCurrentEvent = isset($params['checkCurrentEvent']) && $params['checkCurrentEvent'] === 'Y';
51 $isSharingEventLinkOwner =
52 in_array($item->getEventType(), SharingEventManager::getSharingEventTypes())
53 && $this->isEventLinkOwner($item->getParentEventId(), $this->user->getUserId())
54 ;
55
56 if ($doCheckCurrentEvent || $isSharingEventLinkOwner)
57 {
58 $section = SectionModel::createFromEventModel($item);
59 }
60 else
61 {
62 $section = SectionModel::createFromEventModelParentFields($item);
63 }
64
65 return $this->controller->check(
67 $section,
68 );
69 }
70}
execute(AccessibleItem $item=null, $params=null)
Определения eventeditrule.php:21
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799