|
MediaWiki master
|
This class represents a base for service that provides high-level operations on user groups. More...
Inherited by MediaWiki\User\UserGroupAssignmentService.
Public Member Functions | |
| __construct (private readonly HookRunner $hookRunner,) | |
| getChangeableGroups (Authority $performer, UserIdentity $target, bool $evaluatePrivateConditionsForRestrictedGroups=true) | |
| Returns the groups that the performer can add or remove from the target user. | |
| logAccessToPrivateConditions (Authority $performer, UserIdentity $target, array $addGroups, array $newExpiries, array $existingUGMs,) | |
| Triggers a hook that allows extensions to log when user read some private conditions. | |
| validateUserGroups (Authority $performer, UserIdentity $target, array $addGroups, array $removeGroups, array $newExpiries, array $groupMemberships,) | |
| Validates the requested changes to user groups and returns an array, specifying if some groups are unchangeable and for what reasons. | |
Static Public Member Functions | |
| static | enforceChangeGroupPermissions (array &$addGroups, array &$removeGroups, array &$newExpiries, array $existingUGMs, array $permittedChanges) |
| Ensures that the content of $addGroups, $removeGroups and $newExpiries is compliant with the possible changes defined in $permittedChanges. | |
| static | expiryToTimestamp ( $expiry) |
| Converts a user group membership expiry string into a timestamp. | |
Protected Member Functions | |
| getKnownGroups (UserIdentity $target) | |
| Returns a list of possible known groups for a given identity. | |
| getRestrictedGroupChecker (UserIdentity $target) | |
| Returns an instance of {. | |
This class represents a base for service that provides high-level operations on user groups.
It is responsible for common operations, such as validation and logging primitives.
Definition at line 21 of file UserGroupAssignmentServiceBase.php.
| MediaWiki\User\UserGroupAssignmentServiceBase::__construct | ( | private readonly HookRunner | $hookRunner | ) |
Definition at line 23 of file UserGroupAssignmentServiceBase.php.
|
static |
Ensures that the content of $addGroups, $removeGroups and $newExpiries is compliant with the possible changes defined in $permittedChanges.
If there's a change that is not permitted, it is removed from the respective array.
| list<string> | &$addGroups |
| list<string> | &$removeGroups |
| array<string,?string> | &$newExpiries |
| array<string,UserGroupMembership> | $existingUGMs |
| array{add:list<string>,remove:list<string>} | $permittedChanges |
Definition at line 225 of file UserGroupAssignmentServiceBase.php.
|
static |
Converts a user group membership expiry string into a timestamp.
Words like 'existing' or 'other' should have been filtered out before calling this function.
| string | $expiry |
Definition at line 329 of file UserGroupAssignmentServiceBase.php.
References wfIsInfinity(), and wfTimestamp().
|
abstract |
Returns the groups that the performer can add or remove from the target user.
The result of this function is cached for the duration of the request.
| Authority | $performer | |
| UserIdentity | $target | |
| bool | $evaluatePrivateConditionsForRestrictedGroups | If true, all conditions for restricted groups will be evaluated (including private). If false, private conditions will be left unevaluated and 'condition-met' can be potentially null, if the result depends on private conditions. |
Reimplemented in MediaWiki\User\UserGroupAssignmentService.
|
abstractprotected |
Returns a list of possible known groups for a given identity.
The result of this function is used to skip undefined pre-existing groups when validating group changes.
| UserIdentity | $target | The target user |
Reimplemented in MediaWiki\User\UserGroupAssignmentService.
|
abstractprotected |
Returns an instance of {.
Reimplemented in MediaWiki\User\UserGroupAssignmentService.
| MediaWiki\User\UserGroupAssignmentServiceBase::logAccessToPrivateConditions | ( | Authority | $performer, |
| UserIdentity | $target, | ||
| array | $addGroups, | ||
| array | $newExpiries, | ||
| array | $existingUGMs ) |
Triggers a hook that allows extensions to log when user read some private conditions.
| Authority | $performer | The user who submitted request to change the user groups |
| UserIdentity | $target | The user whose groups are changed |
| list<string> | $addGroups A list of groups that were attempted to be added (or have expiry changed) | |
| array<string,?string> | $newExpiries New expiration times for the groups (null or missing means infinity) | |
| array<string,UserGroupMembership> | $existingUGMs Existing group memberships for the target user |
Definition at line 126 of file UserGroupAssignmentServiceBase.php.
| MediaWiki\User\UserGroupAssignmentServiceBase::validateUserGroups | ( | Authority | $performer, |
| UserIdentity | $target, | ||
| array | $addGroups, | ||
| array | $removeGroups, | ||
| array | $newExpiries, | ||
| array | $groupMemberships ) |
Validates the requested changes to user groups and returns an array, specifying if some groups are unchangeable and for what reasons.
| Authority | $performer | |
| UserIdentity | $target | |
| list<string> | $addGroups | |
| list<string> | $removeGroups | |
| array<string,?string> | $newExpiries | |
| array<string,UserGroupMembership> | $groupMemberships |
Definition at line 65 of file UserGroupAssignmentServiceBase.php.