[Mediawiki-l] Removing User Preference to Change Password

Jamie Bliss astronouth7303 at gmail.com
Tue Aug 16 03:28:04 UTC 2005


On 8/15/05, Joshua Yeidel <yeidel at wsu.edu> wrote:
> I checked the archives of this list (thanks, Gmane
> <http://dir.gmane.org/gmane.org.wikimedia.mediawiki>), without success.
> 
> We are using our own AuthPlugin to authenticate via LDAP against Active
> Directory, with a "fall-through" for accounts that are not defined in AD.
> We would like to present the password-change part of the User Preferences
> panel _only_ to those users who are _not_ authenticated against Active
> Directory.
> 
> We are on 1.4.7 now, with 1.5 upgrade probably not until January.  Any
> suggestions about the cleanest way to implement this in 1.4.7 or in 1.5?

Here's how I would do it. It should be conceptually straight forward,
though a bit of a hack.

Add a function to your AuthPlugin to indicate if a user can change
their password. Then add a similar method to the User object. (the
method really belongs at the user object, the reference to AuthPlugin
is implementation specific.) Then, in SpecialPreferences.php, follow
along.

The password is set in PreferencesForm::savePreferences(), at line
217. I would say put the check to see if the user can change their
password in User::setPassword(). Modify User::setPassword() so that it
returns true if successful or a message (for wfMsg()) that would
contain the error message if it fails. (Of course, you should create
the message.)

To disable the password field on the form, change it's type to hidden:
 <input type="hidden" ... />
(User::canChangePassword() that you wrote above.) That's line 570 and
571 in SpecialPreferences.php (the PreferencesForm::mainPrefsForm()
method)

That should be enough of a roadmap to get you going. It's also
abstracted enough that you could release a patch for MediaWiki.

(That's based on the REL1_5 branch of CVS. A glance at REL1_4 didn't
show significant change in this area, though the line numbers have
probably changed.)

> Thanks in advance.

 No problem.

-- Jamie
-------------------------------------------------------------------
http://endeavour.zapto.org/astro73/
Thank you to JosephM for inviting me to Gmail!
Have lots of invites. Gmail now has 2GB.



More information about the MediaWiki-l mailing list