Per code review: Redo these allowBlah() functions (except allowPasswordChange) into...
authorChad Horohoe <demon@users.mediawiki.org>
Tue, 19 May 2009 16:23:58 +0000 (16:23 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Tue, 19 May 2009 16:23:58 +0000 (16:23 +0000)
includes/AuthPlugin.php
includes/Preferences.php

index 29be2de..3632dbf 100644 (file)
@@ -123,38 +123,22 @@ class AuthPlugin {
        }
 
        /**
-        * Can users change their passwords?
-        *
-        * @return bool
-        */
-       public function allowPasswordChange() {
-               return true;
-       }
-       
-       /**
-        * Can users change their Real Name?
+        * Allow a property change? Properties are the same as preferences
+        * and use the same keys. 'Realname' 'Emailaddress' and 'Nickname'
+        * all reference this.
         *
         * @return bool
         */
-       public function allowRealNameChange() {
+       public function allowPropChange( $prop = '' ) {
                return true;
        }
 
        /**
-        * Can users change their email address?
-        *
-        * @return bool
-        */
-       public function allowEmailChange() {
-               return true;
-       }
-
-       /**
-        * Can users change their Nickname?
+        * Can users change their passwords?
         *
         * @return bool
         */
-       public function allowNickChange() {
+       public function allowPasswordChange() {
                return true;
        }
 
index e076b3f..1c35910 100644 (file)
@@ -142,7 +142,7 @@ class Preferences {
                if ($wgAllowRealName) {
                        $defaultPreferences['realname'] =
                                        array(
-                                               'type' => $wgAuth->allowRealNameChange() ? 'text' : 'info',
+                                               'type' => $wgAuth->allowPropChange( 'realname' ) ? 'text' : 'info',
                                                'default' => $user->getRealName(),
                                                'section' => 'personal/info',
                                                'label-message' => 'yourrealname',
@@ -252,7 +252,7 @@ class Preferences {
                global $wgMaxSigChars;
                $defaultPreferences['nickname'] =
                                array(
-                                       'type' => $wgAuth->allowNickChange() ? 'text' : 'info',
+                                       'type' => $wgAuth->allowPropChange( 'nickname' ) ? 'text' : 'info',
                                        'maxlength' => $wgMaxSigChars,
                                        'label-message' => 'yournick',
                                        'validation-callback' =>
@@ -273,7 +273,7 @@ class Preferences {
                
                $defaultPreferences['emailaddress'] =
                                array(
-                                       'type' => $wgAuth->allowEmailChange() ? 'text' : 'info',
+                                       'type' => $wgAuth->allowPropChange( 'emailaddress' ) ? 'text' : 'info',
                                        'default' => $user->getEmail(),
                                        'section' => 'personal/email',
                                        'label-message' => 'youremail',