MediaWiki
master
Toggle main menu visibility
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
17
public
function
__construct
(
18
protected
readonly
RequestInterface
$request
,
19
protected
readonly
Handler
$handler,
20
) {
21
}
22
28
public
function
authorize
() {
29
if
( $this->handler->needsReadAccess() && !$this->isReadAllowed() ) {
30
return
'rest-read-denied'
;
31
}
32
if
( $this->handler->needsWriteAccess() && !$this->isWriteAllowed() ) {
33
return
'rest-write-denied'
;
34
}
35
return
null
;
36
}
37
43
abstract
protected
function
isReadAllowed
();
44
50
abstract
protected
function
isWriteAllowed
();
51
}
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\isWriteAllowed
isWriteAllowed()
Check if the current user is allowed to write to the wiki.
MediaWiki\Rest\BasicAccess\BasicRequestAuthorizer\isReadAllowed
isReadAllowed()
Check if the current user is allowed to read from the wiki.
MediaWiki\Rest\BasicAccess\BasicRequestAuthorizer\__construct
__construct(protected readonly RequestInterface $request, protected readonly Handler $handler,)
Definition
BasicRequestAuthorizer.php:17
MediaWiki\Rest\BasicAccess\BasicRequestAuthorizer\authorize
authorize()
Definition
BasicRequestAuthorizer.php:28
MediaWiki\Rest\RequestInterface
A request interface similar to PSR-7's ServerRequestInterface.
Definition
RequestInterface.php:39
MediaWiki\Rest\Handler
Copyright (C) 2011-2020 Wikimedia Foundation and others.
Definition
ActionModuleBasedHandler.php:3
$request
$request
Definition
opensearch_desc.php:26
includes
Rest
BasicAccess
BasicRequestAuthorizer.php
Generated on
for MediaWiki by
1.18.0