MediaWiki
REL1_40
CompoundAuthorizer.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Rest\BasicAccess
;
4
5
use
MediaWiki\Rest\Handler
;
6
use
MediaWiki\Rest\RequestInterface
;
7
14
class
CompoundAuthorizer
implements
BasicAuthorizerInterface
{
15
17
private
$authorizers;
18
22
public
function
__construct
( array $authorizers = [] ) {
23
$this->authorizers = $authorizers;
24
}
25
31
public
function
addAuthorizer
(
BasicAuthorizerInterface
$authorizer ):
CompoundAuthorizer
{
32
array_push( $this->authorizers, $authorizer );
33
return
$this;
34
}
35
42
public
function
authorize
(
RequestInterface
$request,
Handler
$handler ) {
43
foreach
( $this->authorizers as $authorizer ) {
44
$result = $authorizer->authorize( $request, $handler );
45
if
( $result ) {
46
return
$result;
47
}
48
}
49
return
null
;
50
}
51
}
MediaWiki\Rest\BasicAccess\CompoundAuthorizer
Definition
CompoundAuthorizer.php:14
MediaWiki\Rest\BasicAccess\CompoundAuthorizer\__construct
__construct(array $authorizers=[])
Definition
CompoundAuthorizer.php:22
MediaWiki\Rest\BasicAccess\CompoundAuthorizer\authorize
authorize(RequestInterface $request, Handler $handler)
Checks all registered authorizers and returns the first encountered error.
Definition
CompoundAuthorizer.php:42
MediaWiki\Rest\BasicAccess\CompoundAuthorizer\addAuthorizer
addAuthorizer(BasicAuthorizerInterface $authorizer)
Adds a BasicAuthorizerInterface to the chain of authorizers.
Definition
CompoundAuthorizer.php:31
MediaWiki\Rest\Handler
Base class for REST route handlers.
Definition
Handler.php:20
MediaWiki\Rest\BasicAccess\BasicAuthorizerInterface
An interface used by Router to ensure that the client has "basic" access, i.e.
Definition
BasicAuthorizerInterface.php:14
MediaWiki\Rest\RequestInterface
A request interface similar to PSR-7's ServerRequestInterface.
Definition
RequestInterface.php:39
MediaWiki\Rest\BasicAccess
Definition
BasicAuthorizerBase.php:3
MediaWiki\Rest\Handler
Copyright (C) 2011-2020 Wikimedia Foundation and others.
Definition
AbstractContributionHandler.php:3
includes
Rest
BasicAccess
CompoundAuthorizer.php
Generated on Thu Jun 27 2024 14:03:54 for MediaWiki by
1.10.0