MediaWiki master
MediaWiki\User\RestrictedUserGroupChecker Class Reference

A service to check whether a user can be added or removed to/from restricted user groups. More...

Public Member Functions

 __construct (ServiceOptions $options, private readonly UserRequirementsConditionChecker $userRequirementsConditionChecker,)
 
 canPerformerAddTargetToGroup (Authority $performer, UserIdentity $target, string $groupName)
 Checks whether the performer can add the target to the given restricted group.
 
 canPerformerIgnoreGroupRestrictions (Authority $performer, string $groupName)
 Returns true if the performer can ignore the conditions for adding or removing users to/from the given group.
 
 doPerformerAndTargetMeetConditionsForAddingToGroup (UserIdentity $performer, UserIdentity $target, string $groupName)
 Checks whether both the performer and the target meet the conditions required for adding the target to the given restricted group.
 
 isGroupRestricted (string $groupName)
 Checks whether the given group is restricted.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

A service to check whether a user can be added or removed to/from restricted user groups.

It checks only the restrictions defined for the group and does not perform any other permission checks.

Since
1.46

Definition at line 19 of file RestrictedUserGroupChecker.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\RestrictedUserGroupChecker::__construct ( ServiceOptions $options,
private readonly UserRequirementsConditionChecker $userRequirementsConditionChecker )

Member Function Documentation

◆ canPerformerAddTargetToGroup()

MediaWiki\User\RestrictedUserGroupChecker::canPerformerAddTargetToGroup ( Authority $performer,
UserIdentity $target,
string $groupName )

Checks whether the performer can add the target to the given restricted group.

Note: This method only tests against the restrictions defined for the group. It doesn't take into account other permission checks that may apply (e.g., whether the performer has the right to edit user groups at all).

Definition at line 51 of file RestrictedUserGroupChecker.php.

◆ canPerformerIgnoreGroupRestrictions()

MediaWiki\User\RestrictedUserGroupChecker::canPerformerIgnoreGroupRestrictions ( Authority $performer,
string $groupName )

Returns true if the performer can ignore the conditions for adding or removing users to/from the given group.

This is the case if the group allows ignoring restrictions and the performer has the 'ignore-restricted-groups' permission.

Definition at line 90 of file RestrictedUserGroupChecker.php.

◆ doPerformerAndTargetMeetConditionsForAddingToGroup()

MediaWiki\User\RestrictedUserGroupChecker::doPerformerAndTargetMeetConditionsForAddingToGroup ( UserIdentity $performer,
UserIdentity $target,
string $groupName )

Checks whether both the performer and the target meet the conditions required for adding the target to the given restricted group.

Note: Even if this method returns false, the performer may still be allowed to add the target to the group if they can ignore group restrictions (use {

See also
canPerformerAddTargetToGroup()} for that). Calling this method may be useful to inform the performer when they ignore the restrictions.

Definition at line 73 of file RestrictedUserGroupChecker.php.

◆ isGroupRestricted()

MediaWiki\User\RestrictedUserGroupChecker::isGroupRestricted ( string $groupName)

Checks whether the given group is restricted.

A group is considered restricted if it has an entry defined in $wgRestrictedGroups (even if its value would be an empty array).

Definition at line 41 of file RestrictedUserGroupChecker.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\User\RestrictedUserGroupChecker::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const RestrictedGroups
Name constant for the RestrictedGroups setting, for use with Config::get()
Access: internal

Definition at line 22 of file RestrictedUserGroupChecker.php.


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