Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1425944
CompoundAuthorizer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
CompoundAuthorizer.php
View Options
<?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
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 12:16 (20 h, 26 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
43/fd/74711d2b7fdd8d3890afb78b9d20
Default Alt Text
CompoundAuthorizer.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment