MediaWiki  master
MediaWiki\Block\BlockPermissionChecker Class Reference

Block permissions. More...

Collaboration diagram for MediaWiki\Block\BlockPermissionChecker:

Public Member Functions

 __construct (ServiceOptions $options, BlockUtils $blockUtils, $target, Authority $performer)
 
 checkBasePermissions ( $checkHideuser=false)
 Check base permission that apply to either block or unblock. More...
 
 checkBlockPermissions ()
 Checks block-related permissions (doesn't check any other permissions) More...
 
 checkEmailPermissions ()
 Check permission to block emailing. More...
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Private Attributes

ServiceOptions $options
 
Authority $performer
 Block performer. More...
 
UserIdentity string null $target
 Block target or null when unknown. More...
 
int null $targetType = null
 One of AbstractBlock::TYPE_* constants, or null when unknown. More...
 

Detailed Description

Block permissions.

This class is responsible for making sure a user has permission to block

This class is usable for both blocking as well as the unblocking process.

Since
1.35

Definition at line 38 of file BlockPermissionChecker.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\BlockPermissionChecker::__construct ( ServiceOptions  $options,
BlockUtils  $blockUtils,
  $target,
Authority  $performer 
)

Member Function Documentation

◆ checkBasePermissions()

MediaWiki\Block\BlockPermissionChecker::checkBasePermissions (   $checkHideuser = false)

Check base permission that apply to either block or unblock.

Since
1.36
Parameters
bool$checkHideuser
Returns
bool|string

Definition at line 89 of file BlockPermissionChecker.php.

◆ checkBlockPermissions()

MediaWiki\Block\BlockPermissionChecker::checkBlockPermissions ( )

Checks block-related permissions (doesn't check any other permissions)

T17810: Sitewide blocked admins should not be able to block/unblock others with one exception; they can block the user who blocked them, to reduce advantage of a malicious account blocking all admins (T150826).

T208965: Partially blocked admins can block and unblock others as normal.

Returns
bool|string True when checks passed, message code for failures

Definition at line 115 of file BlockPermissionChecker.php.

References MediaWiki\User\UserIdentity\equals(), and MediaWiki\User\UserIdentity\getId().

◆ checkEmailPermissions()

MediaWiki\Block\BlockPermissionChecker::checkEmailPermissions ( )

Check permission to block emailing.

Since
1.36
Returns
bool

Definition at line 167 of file BlockPermissionChecker.php.

Member Data Documentation

◆ $options

ServiceOptions MediaWiki\Block\BlockPermissionChecker::$options
private

◆ $performer

Authority MediaWiki\Block\BlockPermissionChecker::$performer
private

Block performer.

Definition at line 52 of file BlockPermissionChecker.php.

Referenced by MediaWiki\Block\BlockPermissionChecker\__construct().

◆ $target

UserIdentity string null MediaWiki\Block\BlockPermissionChecker::$target
private

Block target or null when unknown.

Definition at line 42 of file BlockPermissionChecker.php.

Referenced by MediaWiki\Block\BlockPermissionChecker\__construct().

◆ $targetType

int null MediaWiki\Block\BlockPermissionChecker::$targetType = null
private

One of AbstractBlock::TYPE_* constants, or null when unknown.

Definition at line 47 of file BlockPermissionChecker.php.

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Block\BlockPermissionChecker::CONSTRUCTOR_OPTIONS
Initial value:
= [
'EnableUserEmail',
]
Access: internal
only for use by ServiceWiring and BlockPermissionCheckerFactory

Definition at line 57 of file BlockPermissionChecker.php.


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