MediaWiki REL1_35
BasicRequestAuthorizer.php
Go to the documentation of this file.
1<?php
2
4
7
15abstract class BasicRequestAuthorizer {
16 protected $request;
17 protected $handler;
18
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}
A request authorizer which checks needsReadAccess() and needsWriteAccess() in the handler and calls i...
__construct(RequestInterface $request, Handler $handler)
isWriteAllowed()
Check if the current user is allowed to write to the wiki.
isReadAllowed()
Check if the current user is allowed to read from the wiki.
Base class for REST route handlers.
Definition Handler.php:16
A request interface similar to PSR-7's ServerRequestInterface.