From: Chad Horohoe Date: Tue, 19 May 2009 16:23:58 +0000 (+0000) Subject: Per code review: Redo these allowBlah() functions (except allowPasswordChange) into... X-Git-Tag: 1.31.0-rc.0~41742 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22sites_tous%22%29%20.%20%22?a=commitdiff_plain;h=9b3711e58bce5bf581fae9e4bf9e059c8c777b3d;p=lhc%2Fweb%2Fwiklou.git Per code review: Redo these allowBlah() functions (except allowPasswordChange) into a general allowPropChange(), update Preferences to use this. Checked extensions in SVN using AuthPlugin and none have implemented any of the allow*() functions, so nothing should break. --- diff --git a/includes/AuthPlugin.php b/includes/AuthPlugin.php index 29be2def31..3632dbfd95 100644 --- a/includes/AuthPlugin.php +++ b/includes/AuthPlugin.php @@ -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; } diff --git a/includes/Preferences.php b/includes/Preferences.php index e076b3fec7..1c35910a0c 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -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',