MediaWiki master
|
A StatusValue for permission errors. More...
Inherits StatusValue.
Public Member Functions | |
getBlock () | |
Returns the user block that contributed to permissions being denied, if such a block was provided via setBlock(). | |
getPermission () | |
Returns the name of the permission that was being checked. | |
isBlocked () | |
Returns true when permissions were denied because the user is blocked. | |
isRateLimitExceeded () | |
Whether the user is over the rate limit for some action. | |
setBlock (Block $block) | |
setPermission (string $permission) | |
Sets the name of the permission that is being checked. | |
setRateLimitExceeded () | |
Call this to indicate that the user is over the rate limit for some action. | |
throwErrorPageError () | |
Will throw an appropriate ErrorPageError if isOK() returns false. | |
toLegacyErrorArray () | |
Returns this permission status in legacy error array format. | |
Public Member Functions inherited from StatusValue | |
__toString () | |
Returns a string representation of the status for debugging. | |
error ( $message,... $parameters) | |
Add an error, do not set fatal flag This can be used for non-fatal errors. | |
fatal ( $message,... $parameters) | |
Add an error and set OK to false, indicating that the operation as a whole was fatal. | |
getErrors () | |
Get the list of errors. | |
getErrorsByType ( $type) | |
Returns a list of status messages of the given type. | |
getMessages (?string $type=null) | |
Returns a list of error messages, optionally only those of the given type. | |
getValue () | |
hasMessage ( $message) | |
Returns true if the specified message is present as a warning or error. | |
hasMessagesExcept (... $messages) | |
Returns true if any other message than the specified ones is present as a warning or error. | |
isGood () | |
Returns whether the operation completed and didn't have any error or warnings. | |
isOK () | |
Returns whether the operation completed. | |
merge ( $other, $overwriteValue=false) | |
Merge another status object into this one. | |
replaceMessage ( $source, $dest) | |
If the specified source message exists, replace it with the specified destination message, but keep the same parameters as in the original error. | |
setOK ( $ok) | |
Change operation status. | |
setResult ( $ok, $value=null) | |
Change operation result. | |
splitByErrorType () | |
Splits this StatusValue object into two new StatusValue objects, one which contains only the error messages, and one that contains the warnings, only. | |
warning ( $message,... $parameters) | |
Add a new warning. | |
Static Public Member Functions | |
static | newEmpty () |
Static Public Member Functions inherited from StatusValue | |
static | newFatal ( $message,... $parameters) |
Factory function for fatal errors. | |
static | newGood ( $value=null) |
Factory function for good results. | |
Additional Inherited Members | |
Public Attributes inherited from StatusValue | |
int | $failCount = 0 |
Counter for batch operations. | |
mixed | $statusData |
arbitrary extra data about the operation | |
bool[] | $success = [] |
Map of (key => bool) to indicate success of each part of batch operations. | |
int | $successCount = 0 |
Counter for batch operations. | |
mixed | $value |
Protected Member Functions inherited from StatusValue | |
getStatusArray ( $type=false) | |
Returns a list of status messages of the given type (or all if false) | |
Protected Attributes inherited from StatusValue | |
array[] | $errors = [] |
bool | $ok = true |
A StatusValue for permission errors.
Definition at line 39 of file PermissionStatus.php.
MediaWiki\Permissions\PermissionStatus::getBlock | ( | ) |
Returns the user block that contributed to permissions being denied, if such a block was provided via setBlock().
This is intended to be used to provide additional information to the user that allows them to determine the reason for them being denied an action.
Definition at line 61 of file PermissionStatus.php.
MediaWiki\Permissions\PermissionStatus::getPermission | ( | ) |
Returns the name of the permission that was being checked.
Definition at line 142 of file PermissionStatus.php.
MediaWiki\Permissions\PermissionStatus::isBlocked | ( | ) |
Returns true when permissions were denied because the user is blocked.
Definition at line 72 of file PermissionStatus.php.
MediaWiki\Permissions\PermissionStatus::isRateLimitExceeded | ( | ) |
Whether the user is over the rate limit for some action.
Definition at line 121 of file PermissionStatus.php.
|
static |
Definition at line 89 of file PermissionStatus.php.
MediaWiki\Permissions\PermissionStatus::setBlock | ( | Block | $block | ) |
Block | $block |
Definition at line 81 of file PermissionStatus.php.
MediaWiki\Permissions\PermissionStatus::setPermission | ( | string | $permission | ) |
Sets the name of the permission that is being checked.
Definition at line 132 of file PermissionStatus.php.
MediaWiki\Permissions\PermissionStatus::setRateLimitExceeded | ( | ) |
Call this to indicate that the user is over the rate limit for some action.
Definition at line 111 of file PermissionStatus.php.
MediaWiki\Permissions\PermissionStatus::throwErrorPageError | ( | ) |
Will throw an appropriate ErrorPageError if isOK() returns false.
If isOK() returns true, this method does nothing.
This is a convenience method for use in user interaction code, such as subclasses of SpecialPage.
ErrorPageError |
Definition at line 158 of file PermissionStatus.php.
MediaWiki\Permissions\PermissionStatus::toLegacyErrorArray | ( | ) |
Returns this permission status in legacy error array format.
Definition at line 101 of file PermissionStatus.php.
Referenced by MediaWiki\Content\ContentModelChange\checkPermissions().