Background
Since T409714: Update UserGroupAssignmentService to check restricted groups, it is possible to configure a group such that its members must meet a set of conditions, and users who are adding members must meet certain conditions. This currently works only for local groups.
We need to make this work for global groups too. This should be easier thanks to work already done to share logic between the special pages (T406003) and services (T405575).
How it works for local groups
- SpecialUserRights asks UserGroupAssignmentService for changeable groups
- UserGroupAssignmentService asks UserGroupManager for addable/removeable groups
- UserGroupAssignmentService asks RestrictedUserGroupChecker for restricted groups
- RestrictedUserGroupChecker calculates this, using UserRequirementsConditionChecker
How this could work for global groups
- SpecialGlobalGroupMembership asks GlobalGroupAssignmentService for changeable groups
- GlobalGroupAssignmentService calculates addable/removable/automatic groups
- New functionality: GlobalGroupAssignmentService could ask RestrictedUserGroupChecker for restricted groups
- If using the same config, we would need to disallow global and local groups having the same name
- Or we could use a different config, $wgGlobalRestrictedGroups, and have a local and global version of the RestrictedUserGroupChecker
- RestrictedUserGroupChecker would calculate this, using UserRequirementsConditionChecker
This means the user would need to be a local user rather than a CentralAuthUser, since UserRequirementsConditionChecker works with local users. This seems OK though, since (1) the use-cases we currently know about involve checking 2FA on the local wiki, and (2) where global conditions need to be met (e.g. global editcount), CentralAuth would add these via a hook and check them against the central user.
Acceptance criteria
It is possible to configure a restricted global group, similarly to how a restricted local group would be configured.