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/ui/lib/entityform/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/ui/lib/entityform/scopeaccess.php
<?php

namespace Bitrix\Ui\EntityForm;

use Bitrix\Main\Config\Configuration;
use Bitrix\Main\Engine\CurrentUser;
use Bitrix\Main\Loader;
use Bitrix\Main\ObjectNotFoundException;
use Bitrix\Main\UserField\UserFieldAccess;
use Bitrix\Main\UserFieldTable;

class ScopeAccess
{
	public const SETTINGS_ENTITYFORM_SCOPE_KEY = 'entityFormScope';
	public const SETTINGS_ACCESS_CLASS_KEY = 'access';

	protected $userId;
	protected $moduleId;

	public function __construct(string $moduleId = null, int $userId = null)
	{
		if($userId === null)
		{
			$userId = $this->getDefaultUserId();
		}

		$this->userId = $userId;
		$this->moduleId = $moduleId;
	}

	protected function getDefaultUserId(): int
	{
		global $USER;
		if($USER instanceof \CUser)
		{
			return (int) CurrentUser::get()->getId();
		}

		return 0;
	}

	public static function getInstance(string $moduleId, int $userId = null): ScopeAccess
	{
		$configuration = Configuration::getInstance($moduleId);

		$value = $configuration->get(static::SETTINGS_ENTITYFORM_SCOPE_KEY);
		if (
			is_array($value)
			&& isset($value[static::SETTINGS_ACCESS_CLASS_KEY])
			&& Loader::includeModule($moduleId)
			&& is_a($value[static::SETTINGS_ACCESS_CLASS_KEY], self::class, true)
		)
		{
			return new $value[static::SETTINGS_ACCESS_CLASS_KEY]($moduleId, $userId);
		}

		throw new ObjectNotFoundException('No settings for ScopeAccess');
	}

	public function canRead(int $scopeId): bool
	{
		return true;
	}

	public function canAdd(): bool
	{
		return true;
	}

	public function canUpdate(int $scopeId): bool
	{
		return $this->canAdd();
	}

	public function canDelete($scopeIds): bool
	{
		return $this->canUpdate($scopeIds);
	}

	public function isAdmin(): bool
	{
		return true;
	}

	public function isAdminForEntityTypeId(string $entityTypeId): bool
	{
		return $this->isAdmin();
	}

	public function canAddByEntityTypeId(string $entityTypeId): bool
	{
		return $this->canAdd();
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit