Файловый менеджер - Редактировать - /var/www/html/BasicAccess.zip
Ðазад
PK ! T�� � CompoundAuthorizer.phpnu �Iw�� <?php namespace MediaWiki\Rest\BasicAccess; use MediaWiki\Rest\Handler; use MediaWiki\Rest\RequestInterface; /** * Wraps an array of BasicAuthorizerInterface and checks them * all to authorize the request * @internal * @package MediaWiki\Rest\BasicAccess */ class CompoundAuthorizer implements BasicAuthorizerInterface { /** @var BasicAuthorizerInterface[] */ private $authorizers; /** * @param array $authorizers */ public function __construct( array $authorizers = [] ) { $this->authorizers = $authorizers; } /** * Adds a BasicAuthorizerInterface to the chain of authorizers. * @param BasicAuthorizerInterface $authorizer * @return CompoundAuthorizer */ public function addAuthorizer( BasicAuthorizerInterface $authorizer ): CompoundAuthorizer { $this->authorizers[] = $authorizer; return $this; } /** * Checks all registered authorizers and returns the first encountered error. * @param RequestInterface $request * @param Handler $handler * @return string|null */ public function authorize( RequestInterface $request, Handler $handler ) { foreach ( $this->authorizers as $authorizer ) { $result = $authorizer->authorize( $request, $handler ); if ( $result ) { return $result; } } return null; } } PK ! `=z z MWBasicAuthorizer.phpnu �Iw�� <?php namespace MediaWiki\Rest\BasicAccess; use MediaWiki\Permissions\Authority; use MediaWiki\Rest\Handler; use MediaWiki\Rest\RequestInterface; /** * A factory for MWBasicRequestAuthorizer which passes through a UserIdentity. * * @internal */ class MWBasicAuthorizer extends BasicAuthorizerBase { private Authority $authority; public function __construct( Authority $authority ) { $this->authority = $authority; } protected function createRequestAuthorizer( RequestInterface $request, Handler $handler ): BasicRequestAuthorizer { return new MWBasicRequestAuthorizer( $request, $handler, $this->authority ); } } PK ! 7�Xa� � StaticBasicAuthorizer.phpnu �Iw�� <?php namespace MediaWiki\Rest\BasicAccess; use MediaWiki\Rest\Handler; use MediaWiki\Rest\RequestInterface; /** * An authorizer which returns a value from authorize() which is given in the constructor. * * @internal */ class StaticBasicAuthorizer implements BasicAuthorizerInterface { /** @var string|null */ private $value; /** * @see BasicAuthorizerInterface::authorize() * * @param string|null $value The value returned by authorize(). If the * request is denied, this is the string error code. If the request is * allowed, it is null. */ public function __construct( $value = null ) { $this->value = $value; } public function authorize( RequestInterface $request, Handler $handler ) { return $this->value; } } PK ! -�۞. . BasicAuthorizerBase.phpnu �Iw�� <?php namespace MediaWiki\Rest\BasicAccess; use MediaWiki\Rest\Handler; use MediaWiki\Rest\RequestInterface; /** * An implementation of BasicAuthorizerInterface which creates a request-local * object (a request authorizer) to do the actual authorization. * * @internal */ abstract class BasicAuthorizerBase implements BasicAuthorizerInterface { public function authorize( RequestInterface $request, Handler $handler ) { return $this->createRequestAuthorizer( $request, $handler )->authorize(); } /** * Create a BasicRequestAuthorizer to authorize the request. * * @param RequestInterface $request * @param Handler $handler * @return BasicRequestAuthorizer */ abstract protected function createRequestAuthorizer( RequestInterface $request, Handler $handler ): BasicRequestAuthorizer; } PK ! ��ƻJ J BasicRequestAuthorizer.phpnu �Iw�� <?php namespace MediaWiki\Rest\BasicAccess; use MediaWiki\Rest\Handler; use MediaWiki\Rest\RequestInterface; /** * A request authorizer which checks needsReadAccess() and needsWriteAccess() in the * handler and calls isReadAllowed() and/or isWriteAllowed() in the subclass * accordingly. * * @internal */ abstract class BasicRequestAuthorizer { protected RequestInterface $request; protected Handler $handler; /** * @param RequestInterface $request * @param Handler $handler */ public function __construct( RequestInterface $request, Handler $handler ) { $this->request = $request; $this->handler = $handler; } /** * @see BasicAuthorizerInterface::authorize() * @return string|null If the request is denied, the string error code. If * the request is allowed, null. */ public function authorize() { if ( $this->handler->needsReadAccess() && !$this->isReadAllowed() ) { return 'rest-read-denied'; } if ( $this->handler->needsWriteAccess() && !$this->isWriteAllowed() ) { return 'rest-write-denied'; } return null; } /** * Check if the current user is allowed to read from the wiki * * @return bool */ abstract protected function isReadAllowed(); /** * Check if the current user is allowed to write to the wiki * * @return bool */ abstract protected function isWriteAllowed(); } PK ! �#�� � MWBasicRequestAuthorizer.phpnu �Iw�� <?php namespace MediaWiki\Rest\BasicAccess; use MediaWiki\Permissions\Authority; use MediaWiki\Rest\Handler; use MediaWiki\Rest\RequestInterface; /** * The concrete implementation of basic read/write restrictions in MediaWiki * * @internal */ class MWBasicRequestAuthorizer extends BasicRequestAuthorizer { private Authority $authority; public function __construct( RequestInterface $request, Handler $handler, Authority $authority ) { parent::__construct( $request, $handler ); $this->authority = $authority; } protected function isReadAllowed() { return $this->authority->isAllowed( 'read' ); } protected function isWriteAllowed() { return true; } } PK ! }�i�/ / BasicAuthorizerInterface.phpnu �Iw�� <?php namespace MediaWiki\Rest\BasicAccess; use MediaWiki\Rest\Handler; use MediaWiki\Rest\RequestInterface; /** * An interface used by Router to ensure that the client has "basic" access, * i.e. the ability to read or write to the wiki. * * @internal */ interface BasicAuthorizerInterface { /** * Determine whether a request should be permitted, given the handler's * needsReadAccess() and needsWriteAccess(). * * If the request should be permitted, return null. If the request should * be denied, return a string error identifier. * * @param RequestInterface $request * @param Handler $handler * @return string|null If the request is denied, the string error code. If * the request is allowed, null. */ public function authorize( RequestInterface $request, Handler $handler ); } PK ! T�� � CompoundAuthorizer.phpnu �Iw�� PK ! `=z z < MWBasicAuthorizer.phpnu �Iw�� PK ! 7�Xa� � � StaticBasicAuthorizer.phpnu �Iw�� PK ! -�۞. . 3 BasicAuthorizerBase.phpnu �Iw�� PK ! ��ƻJ J � BasicRequestAuthorizer.phpnu �Iw�� PK ! �#�� � < MWBasicRequestAuthorizer.phpnu �Iw�� PK ! }�i�/ / 4 BasicAuthorizerInterface.phpnu �Iw�� PK m �
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка