(bug 15795) Special:Userrights is now listed on Special:SpecialPages when user can...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 9 Oct 2008 20:12:13 +0000 (20:12 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 9 Oct 2008 20:12:13 +0000 (20:12 +0000)
RELEASE-NOTES
includes/specials/SpecialUserrights.php

index dc89751..3071564 100644 (file)
@@ -252,6 +252,8 @@ The following extensions are migrated into MediaWiki 1.14:
 * (bug 10323) Special:Undelete should have "inverse selection" button
 * (bug 15831) Modern skin RTL support is bugous
 * (bug 15869) Nostalgia skin does not show page title in printable mode
+* (bug 15795) Special:Userrights is now listed on Special:SpecialPages when the
+  user can only his rights
 
 === API changes in 1.14 ===
 
index d913867..36a6e6f 100644 (file)
@@ -26,10 +26,14 @@ class UserrightsPage extends SpecialPage {
        }
 
        public function userCanExecute( $user ) {
+               return $this->userCanChangeRights( $user, false );
+       }
+
+       public function userCanChangeRights( $user, $checkIfSelf = true ) {
                $available = $this->changeableGroups();
                return !empty( $available['add'] )
                        or !empty( $available['remove'] )
-                       or ($this->isself and
+                       or ( ( $this->isself || !$checkIfSelf ) and
                                (!empty( $available['add-self'] )
                                 or !empty( $available['remove-self'] )));
        }
@@ -65,7 +69,7 @@ class UserrightsPage extends SpecialPage {
                if ($this->mTarget == $wgUser->getName())
                        $this->isself = true;
 
-               if( !$this->userCanExecute( $wgUser ) ) {
+               if( !$this->userCanChangeRights( $wgUser, true ) ) {
                        // fixme... there may be intermediate groups we can mention.
                        global $wgOut;
                        $wgOut->showPermissionsErrorPage( array(