Page MenuHomePhabricator

Allow technically enforcing policies for restricted global groups
Open, Needs TriagePublic

Description

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.

Related Objects

Event Timeline

If using the same config, we would need to disallow global and local groups having the same name

This probably best avoided, quickly looking at Wikimedia Meta, this would at the least require the steward global or local group to be renamed, which may cause more headaches for updating things that rely on the group name (don't have an example on hand but I would not be shocked if some existing bots or tools check if a user is a steward by group name. Off Wikimedia, the Miraheze project also has at least 4 groups that have a local and global group of the same name. Making a slightly modifed version of the existing config seems to be the least bothersome option overall.