From: Brion Vibber Date: Wed, 26 Dec 2007 23:28:20 +0000 (+0000) Subject: Don't taunt permissionless users with a username search box on Special:Userrights. X-Git-Tag: 1.31.0-rc.0~50269 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=30ed8acfd9c079b3e87bbd9f3224893417693b70;p=lhc%2Fweb%2Fwiklou.git Don't taunt permissionless users with a username search box on Special:Userrights. Give them a nice little permissions error and a login link for anons. --- diff --git a/includes/SpecialUserrights.php b/includes/SpecialUserrights.php index 2b35f1b169..d10ece3c86 100644 --- a/includes/SpecialUserrights.php +++ b/includes/SpecialUserrights.php @@ -42,6 +42,19 @@ class UserrightsForm extends HTMLForm { * Depending on the submit button used, call a form or a save function. */ function execute() { + // If the visitor doesn't have permissions to assign or remove + // any groups, it's a bit silly to give them the user search prompt. + $available = $this->changeableGroups(); + if( empty( $available['add'] ) && empty( $available['remove'] ) ) { + // fixme... there may be intermediate groups we can mention. + global $wgOut, $wgUser; + $wgOut->showPermissionsErrorPage( array( + $wgUser->isAnon() + ? 'userrights-nologin' + : 'userrights-notallowed' ) ); + return; + } + // show the general form $this->switchForm(); if( $this->mPosted ) { diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 2ead33f90a..50fe3de1d6 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1340,6 +1340,8 @@ Unselected groups will not be changed. You can deselect a group with CTRL + Left 'userrights-available-remove' => 'You can remove users from $1.', 'userrights-no-interwiki' => 'You do not have permission to edit user rights on other wikis.', 'userrights-nodatabase' => 'Database $1 does not exist or is not local.', +'userrights-nologin' => 'You must [[Special:Userlogin|log in]] with an administrator account to assign user rights.', +'userrights-notallowed' => 'Your account does not have permission to assign user rights.', # Groups 'group' => 'Group:',