Page MenuHomePhabricator

pass user group changes to $wgAuth
Closed, ResolvedPublic

Description

Author: mati

Description:
patch against 1.21.1 for the new updateExternalDBGroups function

I'm writing an authentication plugin for an authentication system that also manages Groups.

In the attached patch (tested against 1.21.1), I am proposing to pass added/removed groups to the new AuthPlugin::updateExternalDBGroups function. This function is called when adding/removing groups via Special:Userrights or when a user is autopromoted.

The rationale (and usefulness) behind this new function is the same as with AuthPlugin::updateExternalDB being called after User::saveSettings is called in SpecialPreferences:

User::saveSettings as well as User::addGroup and User::removeGroup feature a Hook, but this is not sufficient for a plugin that also synchronizes data *from* the external authentication source:

  1. I want to save groups *to* the external database when a group is added/removed via the MediaWiki interface
  2. I want to synchronize groups *from* the external database whenever a user logs in.

The first could be done by implementing the UserAddGroup-Hook in User::addGroup. But then I cannot use this function to save new groups from the external database in the second scenario, because the Hook would of course also be called.

I hope I made my rationale clear and hope to get this function in MediaWiki! ;-)


Version: 1.21.x
Severity: normal

Attached:

Details

Reference
bz49641

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:54 AM
bzimport set Reference to bz49641.
bzimport added a subscriber: Unknown Object (MLST).

Hi! Thanks for your patch!

You are welcome to use Developer access

https://www.mediawiki.org/wiki/Developer_access

to submit this as a Git branch directly into Gerrit:

https://www.mediawiki.org/wiki/Git/Tutorial

Putting your branch in Git makes it easier to review it quickly.
Thanks again! We appreciate your contribution.

mati wrote:

Not sure if its still necessary to comment here, but my gerrit change request is here:

https://gerrit.wikimedia.org/r/#/c/70040/

greetings, Mati

Thanks a lot, Mati! For future reference, adding something like "Bug: 49641" as the last line of the commit message will create an automatic notification in Bugzilla, see http://www.mediawiki.org/wiki/Gerrit/Commit_message_guidelines

mati wrote:

Ok, thanks for the hint. I will improve my commit messages!

greetings, Mati

mati wrote:

Hi,

Is there anything I can do to improve the patch? Is there any fundamental problem? Or is just everybody out of time? :-)

Feedback is welcome in any case...

greetings, Mati

I guess https://gerrit.wikimedia.org/r/#/c/70040/ needed some reviewers, so I've added a potential person.
This seems to be an interesting contribution barrier for a first patch, as you cannot know who might be interested in the area of code covered by your patch (though Gerrit allows subscribing to notifications for patches in certain code areas). So I ended up looking at the history log of the three files that you edited.

mati wrote:

The patch is already applied upstream.