Page MenuHomePhabricator

Extract permission management from CentralAuthUser
Closed, ResolvedPublic

Description

Currently, the CentralAuthUser class stores information about the global groups that the user is member of, as well as data about the groups itself, i.e. what permissions they give and what wikisets they are active on. The latter is an additional responsibility, which should be extracted to a separate class, e.g. GlobalPermissionManager (or integrate into GlobalGroupLookup, but maybe not if the class will also check disabled groups).

The current setup makes it so that changes into a global group configuration (e.g., rights or wikiset) require invalidating caches for all users who are members of the changed group. Even though it's not that bad on itself (the largest global groups on Wikimedia are 1.5k and 3k members), that's still something that could be avoided.

Instead, we could have a separate service which is responsible for resolving rights for a global group, with its own cache that would be reused for all users (as group-rights mapping is universal). Such a separate service would make it also easier to implement the disabled global groups (in a separate task).

Acceptance criteria

  • CentralAuthUser is still responsible for listing global groups the user is member of.
  • Resolving groups into rights is done in a separate class.
  • There's no longer need to invalidate cache for all members of a global group if the group's properties (rights, wikiset) change.

Event Timeline

Change #1277074 had a related patch set uploaded (by Mszwarc; author: Mszwarc):

[mediawiki/extensions/CentralAuth@master] Add cache layer to GlobalGroupManager

https://gerrit.wikimedia.org/r/1277074

Change #1277093 had a related patch set uploaded (by Mszwarc; author: Mszwarc):

[mediawiki/extensions/CentralAuth@master] Add GlobalPermissionManager service

https://gerrit.wikimedia.org/r/1277093

Change #1277074 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] Add cache layer to GlobalGroupManager

https://gerrit.wikimedia.org/r/1277074

Change #1277093 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] Add GlobalPermissionManager service

https://gerrit.wikimedia.org/r/1277093

mszwarc reopened this task as In Progress.
mszwarc updated the task description. (Show Details)
mszwarc updated the task description. (Show Details)

Change #1277468 had a related patch set uploaded (by Mszwarc; author: Mszwarc):

[mediawiki/extensions/CentralAuth@master] Use GlobalPermissionManager for resolving global user rights

https://gerrit.wikimedia.org/r/1277468

Change #1277469 had a related patch set uploaded (by Mszwarc; author: Mszwarc):

[mediawiki/extensions/CentralAuth@master] S:GlobalGroupPermissions invalidate user cache only on group rename

https://gerrit.wikimedia.org/r/1277469

Change #1277468 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] Use GlobalPermissionManager for resolving global user rights

https://gerrit.wikimedia.org/r/1277468

Change #1277469 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] S:GlobalGroupPermissions: invalidate user cache only on group rename

https://gerrit.wikimedia.org/r/1277469