MediaWiki master
MediaWiki\Block\BlockPermissionChecker Class Reference

Block permissions. More...

Public Member Functions

 __construct (ServiceOptions $options, BlockTargetFactory $blockTargetFactory, Authority $performer)
 
 checkBasePermissions ( $checkHideuser=false)
 Check the base permission that applies to either block or unblock.
 
 checkBlockPermissions ( $target=null, $freshness=IDBAccessObject::READ_NORMAL)
 Checks block-related permissions (doesn't check any other permissions)
 
 checkEmailPermissions ()
 Check permission to block emailing.
 
 setTarget ( $target)
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

Block permissions.

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

This class is usable for both blocking and unblocking.

Since
1.35

Definition at line 40 of file BlockPermissionChecker.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\BlockPermissionChecker::__construct ( ServiceOptions $options,
BlockTargetFactory $blockTargetFactory,
Authority $performer )
Parameters
ServiceOptions$options
BlockTargetFactory$blockTargetFactoryFor legacy branches only
Authority$performer

Definition at line 71 of file BlockPermissionChecker.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ checkBasePermissions()

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

Check the base permission that applies to either block or unblock.

Since
1.36
Parameters
bool$checkHideuser
Returns
bool|string

Definition at line 98 of file BlockPermissionChecker.php.

◆ checkBlockPermissions()

MediaWiki\Block\BlockPermissionChecker::checkBlockPermissions ( $target = null,
$freshness = IDBAccessObject::READ_NORMAL )

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

T17810: Site-wide 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.

Parameters
BlockTarget | UserIdentity | string | null$targetThe target of the proposed block or unblock operation. Passing null for this parameter is deprecated. This parameter will soon be required. Passing a UserIdentity or string for this parameter is deprecated. Pass a BlockTarget in new code.
int$freshnessIndicates whether slightly stale data is acceptable in exchange for a fast response.
Returns
bool|string True when checks passed, message code for failures

Definition at line 131 of file BlockPermissionChecker.php.

References MediaWiki\Block\BlockTarget\equals(), and wfDeprecatedMsg().

◆ checkEmailPermissions()

MediaWiki\Block\BlockPermissionChecker::checkEmailPermissions ( )

Check permission to block emailing.

Since
1.36
Returns
bool

Definition at line 202 of file BlockPermissionChecker.php.

References MediaWiki\MainConfigNames\EnableUserEmail.

◆ setTarget()

MediaWiki\Block\BlockPermissionChecker::setTarget ( $target)
Access: internal
To support deprecated method BlockPermissionCheckerFactory::newBlockPermissionChecker()
Parameters
UserIdentity | string$target
Returns
void

Definition at line 87 of file BlockPermissionChecker.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Block\BlockPermissionChecker::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const EnableUserEmail
Name constant for the EnableUserEmail setting, for use with Config::get()
Access: internal
only for use by ServiceWiring and BlockPermissionCheckerFactory

Definition at line 60 of file BlockPermissionChecker.php.


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