|
MediaWiki master
|
A StatusValue for permission errors. More...
Inherits StatusValue, and StatusValue.

Public Member Functions | |
| addCheckedReauthOperation (string $operation) | |
| Record that a reauth-gated operation was checked for the requested action, whether or not the reauthentication requirement was currently satisfied. | |
| getBlock () | |
| Returns the user block that contributed to permissions being denied, if such a block was provided via setBlock(). | |
| getCheckedReauthOperations () | |
| List the reauth operation(s) that gate the requested action, even if they were satisfied by a recent reauthentication event (T430197). | |
| getPermission () | |
| Returns the name of the permission that was being checked. | |
| getReauthOperation () | |
| Get the name of the operation the user needs to reauthenticate for, if any. | |
| isBlocked () | |
| Returns true when permissions were denied because the user is blocked. | |
| isRateLimitExceeded () | |
| Whether the user is over the rate limit for some action. | |
| merge ( $other, $overwriteValue=false) | |
| 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. | |
| setReauthOperation (string $operation) | |
| Call this to indicate the user needs to reauthenticate in order to perform the requested action. | |
| throwErrorPageError () | |
| Will throw an appropriate ErrorPageError if isOK() returns false. | |
| Public Member Functions inherited from StatusValue | |
| __construct () | |
| __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 (string $message) | |
| Returns true if the specified message is present as a warning or error. | |
| hasMessagesExcept (string ... $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. | |
| replaceMessage (string $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. | |
| toJsonArray () | |
| JSON serializing a StatusValue is possible only if the value and statusData are JSON-serializable, otherwise an InvalidArgumentException will be thrown. | |
| warning ( $message,... $parameters) | |
| Add a new warning. | |
Static Public Member Functions | |
| static | newEmpty () |
| Static Public Member Functions inherited from StatusValue | |
| static | cast (StatusValue $sv) |
| Succinct helper method to wrap a StatusValue in some other specific subclass. | |
| static | jsonClassHintFor (string $keyName) |
| static | newFatal ( $message,... $parameters) |
| Factory function for fatal errors. | |
| static | newFromJsonArray (array $json) |
| 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. | |
| T | $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.
This status will never have a value. It's only used to keep track of errors.
Definition at line 30 of file PermissionStatus.php.
| MediaWiki\Permissions\PermissionStatus::addCheckedReauthOperation | ( | string | $operation | ) |
Record that a reauth-gated operation was checked for the requested action, whether or not the reauthentication requirement was currently satisfied.
| string | $operation | The name of the reauth operation that was checked |
Definition at line 184 of file PermissionStatus.php.
References if.
Referenced by merge().
| 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 92 of file PermissionStatus.php.
References return.
| MediaWiki\Permissions\PermissionStatus::getCheckedReauthOperations | ( | ) |
List the reauth operation(s) that gate the requested action, even if they were satisfied by a recent reauthentication event (T430197).
Unlike getReauthOperation(), which is only set when reauthentication is currently required (SEC_REAUTH) or impossible (SEC_FAIL), this also includes operations whose check returned SEC_OK. It allows callers to arm client-side reauth UX (e.g. AuthPopup) for the case where a currently valid reauthentication expires before the user completes the action.
Definition at line 203 of file PermissionStatus.php.
References return.
| MediaWiki\Permissions\PermissionStatus::getPermission | ( | ) |
Returns the name of the permission that was being checked.
Definition at line 157 of file PermissionStatus.php.
References return.
| MediaWiki\Permissions\PermissionStatus::getReauthOperation | ( | ) |
Get the name of the operation the user needs to reauthenticate for, if any.
Definition at line 173 of file PermissionStatus.php.
References return.
| MediaWiki\Permissions\PermissionStatus::isBlocked | ( | ) |
Returns true when permissions were denied because the user is blocked.
Definition at line 103 of file PermissionStatus.php.
References return.
| MediaWiki\Permissions\PermissionStatus::isRateLimitExceeded | ( | ) |
Whether the user is over the rate limit for some action.
Definition at line 137 of file PermissionStatus.php.
References return.
| MediaWiki\Permissions\PermissionStatus::merge | ( | $other, | |
| $overwriteValue = false ) |
Reimplemented from StatusValue.
Definition at line 52 of file PermissionStatus.php.
References addCheckedReauthOperation().
Referenced by MediaWiki\Auth\AuthManager\beginAccountLink(), and MediaWiki\Auth\AuthManager\continueAccountLink().
|
static |
Definition at line 117 of file PermissionStatus.php.
References return.
| MediaWiki\Permissions\PermissionStatus::setBlock | ( | Block | $block | ) |
| Block | $block |
Definition at line 112 of file PermissionStatus.php.
References StatusValue\setOK().
| MediaWiki\Permissions\PermissionStatus::setPermission | ( | string | $permission | ) |
Sets the name of the permission that is being checked.
Definition at line 147 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 127 of file PermissionStatus.php.
References StatusValue\fatal().
| MediaWiki\Permissions\PermissionStatus::setReauthOperation | ( | string | $operation | ) |
Call this to indicate the user needs to reauthenticate in order to perform the requested action.
| string | $operation | The name of the operation the user needs to reauthenticate for |
Definition at line 165 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 219 of file PermissionStatus.php.
References if, and StatusValue\isOK().