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