A class to check request restrictions expressed as a JSON object.
More...
Inherits Stringable.
|
| __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.
|
|
A class to check request restrictions expressed as a JSON object.
Definition at line 32 of file MWRestrictions.php.
◆ __construct()
MWRestrictions::__construct |
( |
?array | $restrictions = null | ) |
|
|
protected |
◆ __toString()
MWRestrictions::__toString |
( |
| ) |
|
◆ check()
◆ checkIP()
MWRestrictions::checkIP |
( |
| $ip | ) |
|
Test if an IP address is allowed by the restrictions.
- Parameters
-
- Returns
- bool
Definition at line 174 of file MWRestrictions.php.
Referenced by check().
◆ newDefault()
static MWRestrictions::newDefault |
( |
| ) |
|
|
static |
◆ newFromArray()
static MWRestrictions::newFromArray |
( |
array | $restrictions | ) |
|
|
static |
◆ newFromJson()
static MWRestrictions::newFromJson |
( |
| $json | ) |
|
|
static |
◆ toArray()
MWRestrictions::toArray |
( |
| ) |
|
◆ toJson()
MWRestrictions::toJson |
( |
| $pretty = false | ) |
|
Return the restrictions as a JSON string.
- Parameters
-
bool | string | $pretty | Pretty-print the JSON output, see FormatJson::encode |
- Returns
- string
Definition at line 133 of file MWRestrictions.php.
References toArray().
Referenced by __toString().
◆ userCan()
Test whether an action on the target is allowed by the restrictions.
- Access: internal
- Parameters
-
- Returns
- StatusValue
Definition at line 162 of file MWRestrictions.php.
◆ $validity
The documentation for this class was generated from the following file: