r88400 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88399‎ | r88400 | r88401 >
Date:02:48, 19 May 2011
Author:wikinaut
Status:deferred (Comments)
Tags:
Comment:
introduced an OpenID special pages group; new restricted special page OpenID Dashboard
Modified paths:
  • /trunk/extensions/OpenID/OpenID.hooks.php (modified) (history)
  • /trunk/extensions/OpenID/OpenID.i18n.php (modified) (history)
  • /trunk/extensions/OpenID/OpenID.setup.php (modified) (history)
  • /trunk/extensions/OpenID/SpecialOpenIDDashboard.body.php (added) (history)

Diff [purge]

Index: trunk/extensions/OpenID/OpenID.i18n.php
@@ -37,7 +37,6 @@
3838 'openidserver' => 'OpenID server',
3939 'openidxrds' => 'Yadis file',
4040 'openidconvert' => 'OpenID converter',
41 -
4241 'openiderror' => 'Verification error',
4342 'openiderrortext' => 'An error occured during verification of the OpenID URL.',
4443 'openidconfigerror' => 'OpenID configuration error',
@@ -98,7 +97,6 @@
9998 'openidlogininstructions-passwordloginallowed' => 'If you already have an account on {{SITENAME}}, you can [[Special:UserLogin|log in]] with your username and password as usual.
10099 To use OpenID in the future, you can [[Special:OpenIDConvert|convert your account to OpenID]] after you have logged in normally.',
101100 'openidupdateuserinfo' => 'Update my personal information:',
102 -
103101 'openiddelete' => 'Delete OpenID',
104102 'openiddelete-text' => 'By clicking the "{{int:openiddelete-button}}" button, you will remove the OpenID $1 from your account.
105103 You will no longer be able to log in with this OpenID.',
@@ -126,6 +124,14 @@
127125 'openid-provider-label-yahoo' => 'Log in using your Yahoo account',
128126 'openid-provider-label-aol' => 'Enter your AOL screenname',
129127 'openid-provider-label-other-username' => 'Enter your $1 username',
 128+
 129+ 'specialpages-group-openid' => 'OpenID service pages and status information',
 130+ 'right-openid-dashboard-access' => 'Standard access to the OpenID dashboard',
 131+ 'right-openid-dashboard-admin' => 'Administrator access to the OpenID dashboard',
 132+
 133+ 'openid-dashboard-title' => 'OpenID dashboard',
 134+ 'openid-dashboard-title-admin' => 'OpenID dashboard (administrator)',
 135+ 'openid-dashboard-introduction' => 'The current OpenID extension settings ([$1 help])',
130136 );
131137
132138 /** Message documentation (Message documentation)
@@ -171,6 +177,14 @@
172178 'openid-pref-update-userinfo-on-login' => 'OpenID preference label for updating fron OpenID persona upon login',
173179 'openid-urls-action' => '{{Identical|Action}}',
174180 'openid-urls-delete' => '{{identical|Delete}}',
 181+
 182+ 'specialpages-group-openid' => 'Display group name for OpenID-extension related special pages for Special:SpecialPages',
 183+ 'right-openid-dashboard-access' => 'the standard access right for the OpenID dashboard, which is a restricted special page',
 184+ 'right-openid-dashboard-admin' => 'the special adminstrator access right for the OpenID dashboard, which is a restricted special page',
 185+ 'openid-dashboard-title' => 'Display name and page title for the OpenID dashboard (non-admin) on Special:SpecialPages',
 186+ 'openid-dashboard-title-admin' => 'Display name and page title for the adminstrator OpenID dashboard on Special:SpecialPages',
 187+ 'openid-dashboard-introduction' => 'Intro text for the special OpenID dashboard page: the user gets status information about the current OpenID settings of this wiki.
 188+* $1 is the url of the help page explaining the parameters',
175189 );
176190
177191 /** Faeag Rotuma (Faeag Rotuma)
Index: trunk/extensions/OpenID/OpenID.hooks.php
@@ -25,9 +25,9 @@
2626 $list['CreateAccount'] = 'SpecialOpenIDCreateAccount';
2727 }
2828
29 - # Special pages are added at global scope; remove server-related ones
30 - # if client-only flag is set
31 - $addList = array( 'Login', 'Convert' );
 29+ # Special pages are added at global scope;
 30+ # remove server-related ones if client-only flag is set
 31+ $addList = array( 'Login', 'Convert', 'Dashboard' );
3232 if ( !$wgOpenIDClientOnly ) {
3333 $addList[] = 'Server';
3434 $addList[] = 'XRDS';
@@ -35,6 +35,7 @@
3636
3737 foreach ( $addList as $sp ) {
3838 $list['OpenID' . $sp] = 'SpecialOpenID' . $sp;
 39+ SpecialPageFactory::setGroup( 'OpenID' . $sp, 'openid' );
3940 }
4041
4142 return true;
Index: trunk/extensions/OpenID/OpenID.setup.php
@@ -254,6 +254,7 @@
255255 $wgAutoloadClasses['SpecialOpenIDConvert'] = $dir . 'SpecialOpenIDConvert.body.php';
256256 $wgAutoloadClasses['SpecialOpenIDServer'] = $dir . 'SpecialOpenIDServer.body.php';
257257 $wgAutoloadClasses['SpecialOpenIDXRDS'] = $dir . 'SpecialOpenIDXRDS.body.php';
 258+$wgAutoloadClasses['SpecialOpenIDDashboard'] = $dir . 'SpecialOpenIDDashboard.body.php';
258259
259260 # UI class
260261 $wgAutoloadClasses['OpenIDProvider'] = $dir . 'OpenIDProvider.body.php';
@@ -283,6 +284,11 @@
284285 # FIXME, function does not exist
285286 # $wgHooks['UserLoginForm'][] = 'OpenIDHooks::onUserLoginForm';
286287
 288+# new user rights
 289+$wgAvailableRights[] = array( 'openid-dashboard-access', 'openid-dashboard-admin' );
 290+$wgGroupPermissions['user']['openid-dashboard-access'] = true;
 291+$wgGroupPermissions['sysop']['openid-dashboard-admin'] = true;
 292+
287293 $myResourceTemplate = array(
288294 'localBasePath' => dirname( __FILE__ ) . '/skin',
289295 'remoteExtPath' => 'OpenID/skin',
Index: trunk/extensions/OpenID/SpecialOpenIDDashboard.body.php
@@ -0,0 +1,90 @@
 2+<?php
 3+/**
 4+ * Implements Special:OpenIDDashboard parameter settings and status information
 5+ *
 6+ * @ingroup SpecialPage
 7+ * @ingroup Extensions
 8+ * @version 0.1
 9+ * @author Thomas Gries
 10+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 11+ * @link http://www.mediawiki.org/wiki/Extension:OpenID Documentation
 12+ *
 13+ */
 14+class SpecialOpenIDDashboard extends SpecialPage {
 15+
 16+ /**
 17+ * Constructor - sets up the new special page
 18+ * required right: openid-dashboard-access
 19+ */
 20+ public function __construct() {
 21+ parent::__construct( 'OpenIDDashboard', 'openid-dashboard-access' );
 22+ }
 23+
 24+ /**
 25+ * Different description will be shown on Special:SpecialPage depending on
 26+ * whether the user has the 'openiddashboard' right or not.
 27+ */
 28+ function getDescription() {
 29+ global $wgUser;
 30+
 31+ return wfMsg( $wgUser->isAllowed( 'openid-dashboard-admin' ) ?
 32+ 'openid-dashboard-title-admin' : 'openid-dashboard-title' ) ;
 33+ }
 34+
 35+
 36+ /**
 37+ * Show the special page
 38+ *
 39+ * @param $par Mixed: parameter passed to the page or null
 40+ */
 41+ function execute( $par ) {
 42+
 43+ function show( $string, $value ) {
 44+ if ( isset($value) ) {
 45+ $value = ( $value===false ) ? 'false' : $value;
 46+ } else {
 47+ $value = 'undefined';
 48+ }
 49+ return "<tr><td>$string</td><td>$value</td></tr>";
 50+ }
 51+
 52+ global $wgOut, $wgUser;
 53+ global $wgOpenIDShowUrlOnUserPage;
 54+ global $wgOpenIDTrustEmailAddress;
 55+ global $wgOpenIDAllowExistingAccountSelection;
 56+ global $wgOpenIDAllowNewAccountname;
 57+ global $wgOpenIDUseEmailAsNickname;
 58+ global $wgOpenIDProposeUsernameFromSREG;
 59+ global $wgOpenIDAllowAutomaticUsername;
 60+ global $wgOpenIDOnly;
 61+ global $wgOpenIDClientOnly;
 62+ global $wgOpenIDAllowServingOpenIDUserAccounts;
 63+ global $wgOpenIDShowProviderIcons;
 64+
 65+ $out = "<table class='openiddashboard wikitable'><tr><th>Parameter</th><th>Value</th></tr>";
 66+ $out .= show( '$wgOpenIDOnly', $wgOpenIDOnly );
 67+ $out .= show( '$wgOpenIDClientOnly', $wgOpenIDClientOnly );
 68+ $out .= show( '$wgOpenIDAllowServingOpenIDUserAccounts', $wgOpenIDAllowServingOpenIDUserAccounts );
 69+ $out .= show( '$wgOpenIDTrustEmailAddress', $wgOpenIDTrustEmailAddress );
 70+ $out .= show( '$wgOpenIDAllowExistingAccountSelection', $wgOpenIDAllowExistingAccountSelection );
 71+ $out .= show( '$wgOpenIDAllowAutomaticUsername', $wgOpenIDAllowAutomaticUsername );
 72+ $out .= show( '$wgOpenIDAllowNewAccountname', $wgOpenIDAllowNewAccountname );
 73+ $out .= show( '$wgOpenIDUseEmailAsNickname', $wgOpenIDUseEmailAsNickname );
 74+ $out .= show( '$wgOpenIDProposeUsernameFromSREG', $wgOpenIDProposeUsernameFromSREG );
 75+ $out .= show( '$wgOpenIDShowUrlOnUserPage', $wgOpenIDShowUrlOnUserPage );
 76+ $out .= show( '$wgOpenIDShowProviderIcons', $wgOpenIDShowProviderIcons );
 77+ $out .= '</table>';
 78+
 79+ $this->setHeaders();
 80+ $this->outputHeader();
 81+ $wgOut->addWikiMsg( 'openid-dashboard-introduction', 'http://www.mediawiki.org/wiki/Extension:OpenID' );
 82+ $wgOut->addHTML( $out );
 83+ }
 84+
 85+ function error() {
 86+ global $wgOut;
 87+ $args = func_get_args();
 88+ $wgOut->wrapWikiMsg( "<p class='error'>$1</p>", $args );
 89+ }
 90+
 91+}
Property changes on: trunk/extensions/OpenID/SpecialOpenIDDashboard.body.php
___________________________________________________________________
Added: svn:eol-style
192 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r89607follow-up r88400: localized dashboard messages which are not names of variableswikinaut21:00, 6 June 2011

Comments

#Comment by 😂 (talk | contribs)   02:21, 3 June 2011

Reviewing the dashboard in full (as of HEAD) since this is where it was introduced:

  • Exposing configuration via the UI like this is a bad idea. Eventually this will all be exposed via Special:Configure or whatever we end up doing in core.
  • In r88697 you hardcode a lot of statistics. This should be localized.
#Comment by Wikinaut (talk | contribs)   23:53, 5 June 2011
  • The intention is to have full configuration info in the current phase for only sysops available. This is done by testing the permissions (I will fine-tune this in the next few day, until June 10, 2011. Normal users should see whether the OpenID server is enabled or not, perhaps the number of OpenID accounts.
  • Statistics will be localized soon.

Thanks for pointing me to these issues. For (current) deep testing the Dashboard appears to be still essential for Sysops.

Status & tagging log