|
MediaWiki master
|
A class to check request restrictions expressed as a JSON object. More...
Inherits Stringable.

Public Member Functions | |
| __toString () | |
| check (WebRequest $request) | |
| Test against the passed WebRequest. | |
| checkIP ( $ip) | |
| Test if an IP address is allowed by the restrictions. | |
| toArray () | |
| Return the restrictions as an array. | |
| toJson ( $pretty=false) | |
| Return the restrictions as a JSON string. | |
| userCan (LinkTarget $target) | |
| Test whether an action on the target is allowed by the restrictions. | |
Static Public Member Functions | |
| static | newDefault () |
| static | newFromArray (array $restrictions) |
| static | newFromJson ( $json) |
Public Attributes | |
| StatusValue | $validity |
Protected Member Functions | |
| __construct (?array $restrictions=null) | |
A class to check request restrictions expressed as a JSON object.
Definition at line 24 of file MWRestrictions.php.
|
protected |
| array | null | $restrictions |
| InvalidArgumentException |
Definition at line 38 of file MWRestrictions.php.
| MediaWiki\Utils\MWRestrictions::__toString | ( | ) |
Definition at line 129 of file MWRestrictions.php.
References MediaWiki\Utils\MWRestrictions\toJson().
| MediaWiki\Utils\MWRestrictions::check | ( | WebRequest | $request | ) |
Test against the passed WebRequest.
| WebRequest | $request |
Definition at line 138 of file MWRestrictions.php.
References MediaWiki\Utils\MWRestrictions\checkIP(), and MediaWiki\Request\WebRequest\getIP().
| MediaWiki\Utils\MWRestrictions::checkIP | ( | $ip | ) |
Test if an IP address is allowed by the restrictions.
| string | $ip |
Definition at line 166 of file MWRestrictions.php.
Referenced by MediaWiki\Utils\MWRestrictions\check().
|
static |
Definition at line 48 of file MWRestrictions.php.
Referenced by MediaWiki\HTMLForm\Field\HTMLRestrictionsField\getDefault().
|
static |
| array | $restrictions |
| InvalidArgumentException |
Definition at line 57 of file MWRestrictions.php.
Referenced by MediaWiki\HTMLForm\Field\HTMLRestrictionsField\loadDataFromRequest().
|
static |
| string | $json | JSON representation of the restrictions |
| InvalidArgumentException |
Definition at line 66 of file MWRestrictions.php.
| MediaWiki\Utils\MWRestrictions::toArray | ( | ) |
Return the restrictions as an array.
Definition at line 112 of file MWRestrictions.php.
Referenced by MediaWiki\Utils\MWRestrictions\toJson().
| MediaWiki\Utils\MWRestrictions::toJson | ( | $pretty = false | ) |
Return the restrictions as a JSON string.
| bool | string | $pretty | Pretty-print the JSON output, see FormatJson::encode |
Definition at line 125 of file MWRestrictions.php.
References MediaWiki\Utils\MWRestrictions\toArray().
Referenced by MediaWiki\Utils\MWRestrictions\__toString().
| MediaWiki\Utils\MWRestrictions::userCan | ( | LinkTarget | $target | ) |
Test whether an action on the target is allowed by the restrictions.
| LinkTarget | $target |
Definition at line 154 of file MWRestrictions.php.
| StatusValue MediaWiki\Utils\MWRestrictions::$validity |
Definition at line 32 of file MWRestrictions.php.