Page MenuHomePhabricator

Factor group membership management out of User class
Open, MediumPublic

Description

To reduce coupling, functionality related to user group management should be factored out of the User class. Some of the relevant code is already encapsulated in the UserGroupMembership class. UserGroupMembership however should be replaced by (or become) a pure value object.

Proposed design: introduce a UserGroupManager service that offers the following methods:

  • getExpliciteGroups( UserIdentity )
  • getAutomaticGroups( UserIdentity )
  • getEffectiveGroups( UserIdentity )
  • getFormerGroups( UserIdentity )
  • addToGroup( UserIdentity, $group )
  • removeFromGroup( UserIdentity, $group )
  • getGroupLink( $group, UserIdentity|null )

Details

Event Timeline

daniel created this task.Oct 8 2019, 1:01 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 8 2019, 1:01 PM

Change 545690 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[mediawiki/core@master] WIP: Create UserGroupManager

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

Change 547029 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[mediawiki/extensions/Wikibase@master] Tests: Don't reuse the same username for users with different groups.

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

Change 547029 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Tests: Don't reuse the same username for users with different groups.

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

tosfos assigned this task to Vedmaka.Nov 1 2019, 6:19 PM
tosfos added a subscriber: tosfos.

Change 552625 had a related patch set uploaded (by Vedmaka Wakalaka; owner: Vedmaka Wakalaka):
[mediawiki/core@master] Adds missing tests for User class related to group management, covers:

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

Change 552625 merged by jenkins-bot:
[mediawiki/core@master] Adds missing tests for User class related to group management, covers:

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

daniel triaged this task as Medium priority.Wed, Apr 8, 11:28 AM