MediaWiki master
CompoundAuthorizer.php
Go to the documentation of this file.
1<?php
2
4
7
15
17 private $authorizers;
18
22 public function __construct( array $authorizers = [] ) {
23 $this->authorizers = $authorizers;
24 }
25
32 $this->authorizers[] = $authorizer;
33 return $this;
34 }
35
42 public function authorize( RequestInterface $request, Handler $handler ) {
43 foreach ( $this->authorizers as $authorizer ) {
44 $result = $authorizer->authorize( $request, $handler );
45 if ( $result ) {
46 return $result;
47 }
48 }
49 return null;
50 }
51}
authorize(RequestInterface $request, Handler $handler)
Checks all registered authorizers and returns the first encountered error.
addAuthorizer(BasicAuthorizerInterface $authorizer)
Adds a BasicAuthorizerInterface to the chain of authorizers.
Base class for REST route handlers.
Definition Handler.php:21
An interface used by Router to ensure that the client has "basic" access, i.e.
A request interface similar to PSR-7's ServerRequestInterface.
Copyright (C) 2011-2020 Wikimedia Foundation and others.