From c04dc9282740f9837de79d71348afb0b09510312 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 9 Oct 2008 20:12:13 +0000 Subject: [PATCH] (bug 15795) Special:Userrights is now listed on Special:SpecialPages when user can only his rights --- RELEASE-NOTES | 2 ++ includes/specials/SpecialUserrights.php | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index dc897510e0..30715642bf 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index d91386788e..36a6e6f795 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -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( -- 2.20.1