MediaWiki  master
MediaWiki\Permissions\PermissionStatus Class Reference

A StatusValue for permission errors. More...

Inheritance diagram for MediaWiki\Permissions\PermissionStatus:
Collaboration diagram for MediaWiki\Permissions\PermissionStatus:

Public Member Functions

 getBlock ()
 Returns the user block that contributed to permissions being denied, if such a block was provided via setBlock(). More...
 
 setBlock (Block $block)
 
 toLegacyErrorArray ()
 Returns this permission status in legacy error array format. More...
 
- Public Member Functions inherited from StatusValue
 __toString ()
 
 error ( $message,... $parameters)
 Add an error, do not set fatal flag This can be used for non-fatal errors. More...
 
 fatal ( $message,... $parameters)
 Add an error and set OK to false, indicating that the operation as a whole was fatal. More...
 
 getErrors ()
 Get the list of errors. More...
 
 getErrorsByType ( $type)
 Returns a list of status messages of the given type. More...
 
 getValue ()
 
 hasMessage ( $message)
 Returns true if the specified message is present as a warning or error. More...
 
 isGood ()
 Returns whether the operation completed and didn't have any error or warnings. More...
 
 isOK ()
 Returns whether the operation completed. More...
 
 merge ( $other, $overwriteValue=false)
 Merge another status object into this one. More...
 
 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. More...
 
 setOK ( $ok)
 Change operation status. More...
 
 setResult ( $ok, $value=null)
 Change operation result. More...
 
 splitByErrorType ()
 Splits this StatusValue object into two new StatusValue objects, one which contains only the error messages, and one that contains the warnings, only. More...
 
 warning ( $message,... $parameters)
 Add a new warning. More...
 

Static Public Member Functions

static newEmpty ()
 
- Static Public Member Functions inherited from StatusValue
static newFatal ( $message,... $parameters)
 Factory function for fatal errors. More...
 
static newGood ( $value=null)
 Factory function for good results. More...
 

Private Attributes

Block $block = null
 

Additional Inherited Members

- Public Attributes inherited from StatusValue
int $failCount = 0
 Counter for batch operations. More...
 
bool[] $success = []
 Map of (key => bool) to indicate success of each part of batch operations. More...
 
int $successCount = 0
 Counter for batch operations. More...
 
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) More...
 
- Protected Attributes inherited from StatusValue
array[] $errors = []
 
bool $ok = true
 

Detailed Description

A StatusValue for permission errors.

Todo:
Add compat code for PermissionManager::getPermissionErrors and additional info about user blocks.
Stability: unstable
Since
1.36

Definition at line 35 of file PermissionStatus.php.

Member Function Documentation

◆ getBlock()

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.

Since
1.37
Returns
?Block

Definition at line 51 of file PermissionStatus.php.

References MediaWiki\Permissions\PermissionStatus\$block.

◆ newEmpty()

static MediaWiki\Permissions\PermissionStatus::newEmpty ( )
static
Returns
static

Definition at line 67 of file PermissionStatus.php.

Referenced by Page\DeletePage\authorizeDeletion(), and Page\RollbackPage\authorizeRollback().

◆ setBlock()

MediaWiki\Permissions\PermissionStatus::setBlock ( Block  $block)
Since
1.37
Access: internal
Parameters
Block$block

Definition at line 60 of file PermissionStatus.php.

References MediaWiki\Permissions\PermissionStatus\$block.

◆ toLegacyErrorArray()

MediaWiki\Permissions\PermissionStatus::toLegacyErrorArray ( )

Returns this permission status in legacy error array format.

See also
PermissionManager::getPermissionErrors()
Returns
array

Definition at line 78 of file PermissionStatus.php.

References StatusValue\getStatusArray().

Referenced by ContentModelChange\checkPermissions(), and OutputPage\formatPermissionStatus().

Member Data Documentation

◆ $block

Block MediaWiki\Permissions\PermissionStatus::$block = null
private

The documentation for this class was generated from the following file: