Protect private wikis by providing basic read restrictions, closely following the example of the action API. The BasicAccess module provides a narrow interface for this functionality, without exposing the whole session/user concept to the router. Also, add RouterTest and fix a bug in Router::getRelativePath() thus discovered. Change-Id: I82319d56f08b2eec4a585ff6dbd348ccdbadc5b5
28 lines
792 B
PHP
28 lines
792 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Rest\BasicAccess;
|
|
|
|
use MediaWiki\Rest\Handler;
|
|
use MediaWiki\Rest\RequestInterface;
|
|
|
|
/**
|
|
* An interface used by Router to ensure that the client has "basic" access,
|
|
* i.e. the ability to read or write to the wiki.
|
|
*
|
|
* @internal
|
|
*/
|
|
interface BasicAuthorizerInterface {
|
|
/**
|
|
* Determine whether a request should be permitted, given the handler's
|
|
* needsReadAccess().
|
|
*
|
|
* If the request should be permitted, return null. If the request should
|
|
* be denied, return a string error identifier.
|
|
*
|
|
* @param RequestInterface $request
|
|
* @param Handler $handler
|
|
* @return string|null If the request is denied, the string error code. If
|
|
* the request is allowed, null.
|
|
*/
|
|
public function authorize( RequestInterface $request, Handler $handler );
|
|
}
|