MediaWiki  master
MWBasicRequestAuthorizer.php
Go to the documentation of this file.
1 <?php
2 
4 
9 
17  private $user;
18 
21 
24  ) {
25  parent::__construct( $request, $handler );
26  $this->user = $user;
27  $this->permissionManager = $permissionManager;
28  }
29 
30  protected function isReadAllowed() {
31  return $this->permissionManager->isEveryoneAllowed( 'read' )
32  || $this->isAllowed( 'read' );
33  }
34 
35  protected function isWriteAllowed() {
36  return $this->isAllowed( 'writeapi' );
37  }
38 
39  private function isAllowed( $action ) {
40  return $this->permissionManager->userHasRight( $this->user, $action );
41  }
42 }
__construct(RequestInterface $request, Handler $handler, UserIdentity $user, PermissionManager $permissionManager)
string $action
Cache what action this request is.
Definition: MediaWiki.php:42
Interface for objects representing user identity.
A request interface similar to PSR-7&#39;s ServerRequestInterface.
The concrete implementation of basic read/write restrictions in MediaWiki.
A request authorizer which checks needsReadAccess() and needsWriteAccess() in the handler and calls i...
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...