MediaWiki
fundraising/REL1_35
BasicRequestAuthorizer.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
15
abstract
class
BasicRequestAuthorizer
{
16
protected
$request
;
17
protected
$handler
;
18
23
public
function
__construct
(
RequestInterface
$request
,
Handler
$handler
) {
24
$this->request =
$request
;
25
$this->handler =
$handler
;
26
}
27
33
public
function
authorize
() {
34
if
( $this->handler->needsReadAccess() && !$this->isReadAllowed() ) {
35
return
'rest-read-denied'
;
36
}
37
if
( $this->handler->needsWriteAccess() && !$this->isWriteAllowed() ) {
38
return
'rest-write-denied'
;
39
}
40
return
null
;
41
}
42
48
abstract
protected
function
isReadAllowed
();
49
55
abstract
protected
function
isWriteAllowed
();
56
}
MediaWiki\Rest\BasicAccess\BasicRequestAuthorizer
A request authorizer which checks needsReadAccess() and needsWriteAccess() in the handler and calls i...
Definition
BasicRequestAuthorizer.php:15
MediaWiki\Rest\BasicAccess\BasicRequestAuthorizer\$handler
$handler
Definition
BasicRequestAuthorizer.php:17
MediaWiki\Rest\BasicAccess\BasicRequestAuthorizer\__construct
__construct(RequestInterface $request, Handler $handler)
Definition
BasicRequestAuthorizer.php:23
MediaWiki\Rest\BasicAccess\BasicRequestAuthorizer\isWriteAllowed
isWriteAllowed()
Check if the current user is allowed to write to the wiki.
MediaWiki\Rest\BasicAccess\BasicRequestAuthorizer\$request
$request
Definition
BasicRequestAuthorizer.php:16
MediaWiki\Rest\BasicAccess\BasicRequestAuthorizer\isReadAllowed
isReadAllowed()
Check if the current user is allowed to read from the wiki.
MediaWiki\Rest\BasicAccess\BasicRequestAuthorizer\authorize
authorize()
Definition
BasicRequestAuthorizer.php:33
MediaWiki\Rest\Handler
Base class for REST route handlers.
Definition
Handler.php:16
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
Definition
ActionModuleBasedHandler.php:3
includes
Rest
BasicAccess
BasicRequestAuthorizer.php
Generated on Mon Nov 25 2024 16:15:29 for MediaWiki by
1.10.0