(bug 9219) Auth plugins can control editing RealName/Email/Nick preferences. Based...
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 1 May 2009 01:27:22 +0000 (01:27 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 1 May 2009 01:27:22 +0000 (01:27 +0000)
CREDITS
RELEASE-NOTES
includes/AuthPlugin.php
includes/Preferences.php

diff --git a/CREDITS b/CREDITS
index fb64629..33cbd5b 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -81,6 +81,7 @@ following names for their contribution to the product.
 * Michael Walsh
 * Mike Horvath
 * Mormegil
+* MrPete
 * Nakon
 * Nathan Larson
 * nephele
index 015ee30..56dfe79 100644 (file)
@@ -175,6 +175,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 18242) Show the Subversion revision number per extensions in 
   Special:Version
 * (bug 18420) Missing file revisions are handled gracefully now
+* (bug 9219) Auth plugins can control editing RealName/Email/Nick preferences
 
 === Bug fixes in 1.15 ===
 * (bug 16968) Special:Upload no longer throws useless warnings.
index b29e13f..f4a4b10 100644 (file)
@@ -130,6 +130,33 @@ class AuthPlugin {
        public function allowPasswordChange() {
                return true;
        }
+       
+       /**
+        * Can users change their Real Name?
+        *
+        * @return bool
+        */
+       public function allowRealNameChange() {
+               return false;
+       }
+
+       /**
+        * Can users change their email address?
+        *
+        * @return bool
+        */
+       public function allowEmailChange() {
+               return false;
+       }
+
+       /**
+        * Can users change their Nickname?
+        *
+        * @return bool
+        */
+       public function allowNickChange() {
+               return false;
+       }
 
        /**
         * Set the given password in the authentication database.
index 2040bb5..652ac08 100644 (file)
@@ -138,11 +138,11 @@ class Preferences {
                }
                                
                // Actually changeable stuff
-               global $wgAllowRealName;
+               global $wgAllowRealName, $wgAuth;
                if ($wgAllowRealName) {
                        $defaultPreferences['realname'] =
                                        array(
-                                               'type' => 'text',
+                                               'type' => $wgAuth->allowRealNameChange() ? 'text' : 'info',
                                                'default' => $user->getRealName(),
                                                'section' => 'personal/info',
                                                'label-message' => 'yourrealname',
@@ -164,7 +164,6 @@ class Preferences {
                                        'help-message' => 'prefs-help-gender',
                                );
 
-               global $wgAuth;
                if ($wgAuth->allowPasswordChange()) {
                        global $wgUser; // For skin.
                        $link = $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'ResetPass' ),
@@ -253,7 +252,7 @@ class Preferences {
                global $wgMaxSigChars;
                $defaultPreferences['nickname'] =
                                array(
-                                       'type' => 'text',
+                                       'type' => $wgAuth->allowNickChange() ? 'text' : 'info',
                                        'maxlength' => $wgMaxSigChars,
                                        'label-message' => 'yournick',
                                        'validation-callback' =>
@@ -274,7 +273,7 @@ class Preferences {
                
                $defaultPreferences['emailaddress'] =
                                array(
-                                       'type' => 'text',
+                                       'type' => $wgAuth->allowEmailChange() ? 'text' : 'info',
                                        'default' => $user->getEmail(),
                                        'section' => 'personal/email',
                                        'label-message' => 'youremail',