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/lists/lib/security/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/lists/lib/security/right.php
<?php
namespace Bitrix\Lists\Security;

use Bitrix\Main\Error;
use Bitrix\Main\Errorable;
use Bitrix\Main\ErrorCollection;
use Bitrix\Main\ErrorableImplementation;
use Bitrix\Main\Localization\Loc;

class Right implements Errorable
{
	use ErrorableImplementation;

	const ACCESS_DENIED = 'ACCESS_DENIED';

	private $entityRight;
	private $rightParam;

	private $listsPermission;

	public function __construct(RightParam $rightParam, RightEntity $entityRight)
	{
		$this->entityRight = $entityRight;
		$this->rightParam = $rightParam;

		$this->listsPermission = $this->getListsPermission();

		$this->entityRight->setListsPermission($this->listsPermission);

		$this->errorCollection = new ErrorCollection;
	}

	/**
	 * Checks access to the entity.
	 *
	 * @param string $entityMethod Entity method to check access.
	 *
	 * @return bool
	 */
	public function checkPermission($entityMethod = '')
	{
		if ($this->listsPermission < 0)
		{
			switch ($this->listsPermission)
			{
				case \CListPermissions::WRONG_IBLOCK_TYPE:
					$this->errorCollection->setError(
						new Error(Loc::getMessage('LISTS_LIB_SECURITY_RIGHT_ERROR_WRONG_IBLOCK_TYPE')),
						self::ACCESS_DENIED
					);
					break;
				case \CListPermissions::WRONG_IBLOCK:
					$this->errorCollection->setError(
						new Error(Loc::getMessage('LISTS_LIB_SECURITY_RIGHT_ERROR_WRONG_IBLOCK')),
						self::ACCESS_DENIED
					);
					break;
				case \CListPermissions::LISTS_FOR_SONET_GROUP_DISABLED:
					$this->errorCollection->setError(
						new Error(Loc::getMessage('LISTS_LIB_SECURITY_RIGHT_ERROR_SONET_GROUP_DISABLED'),
							self::ACCESS_DENIED)
					);
					break;
				default:
					$this->errorCollection->setError(
						new Error(Loc::getMessage('LISTS_LIB_SECURITY_RIGHT_ERROR_ACCESS_DENIED'),
							self::ACCESS_DENIED)
					);
					break;
			}
		}

		if ($entityMethod)
		{
			if (method_exists($this->entityRight, $entityMethod))
			{
				if (!$this->entityRight->$entityMethod())
				{
					$this->errorCollection->setError(
						new Error(Loc::getMessage('LISTS_LIB_SECURITY_RIGHT_ERROR_ACCESS_DENIED'),
							self::ACCESS_DENIED)
					);
				}
			}
			else
			{
				$this->errorCollection->setError(
					new Error(Loc::getMessage('LISTS_LIB_SECURITY_RIGHT_ERROR_ACCESS_DENIED'),
						self::ACCESS_DENIED)
				);
			}
		}

		if ($this->hasErrors())
		{
			return false;
		}

		return true;
	}

	private function getListsPermission()
	{
		return \CListPermissions::checkAccess(
			$this->rightParam->getUser(),
			$this->rightParam->getIblockTypeId(),
			$this->rightParam->getIblockId(),
			$this->rightParam->getSocnetGroupId()
		);
	}

	public function getPermission(): int|string
	{
		return $this->listsPermission;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit