Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
MWBasicRequestAuthorizer | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
isReadAllowed | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isWriteAllowed | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Rest\BasicAccess; |
4 | |
5 | use MediaWiki\Permissions\Authority; |
6 | use MediaWiki\Rest\Handler; |
7 | use MediaWiki\Rest\RequestInterface; |
8 | |
9 | /** |
10 | * The concrete implementation of basic read/write restrictions in MediaWiki |
11 | * |
12 | * @internal |
13 | */ |
14 | class MWBasicRequestAuthorizer extends BasicRequestAuthorizer { |
15 | /** @var Authority */ |
16 | private $authority; |
17 | |
18 | public function __construct( |
19 | RequestInterface $request, |
20 | Handler $handler, |
21 | Authority $authority |
22 | ) { |
23 | parent::__construct( $request, $handler ); |
24 | $this->authority = $authority; |
25 | } |
26 | |
27 | protected function isReadAllowed() { |
28 | return $this->authority->isAllowed( 'read' ); |
29 | } |
30 | |
31 | protected function isWriteAllowed() { |
32 | return $this->authority->isAllowed( 'writeapi' ); |
33 | } |
34 | } |