Don't show the "permissions error" page after a user self-removes rights
- Instead show a message saying that it will no longer be able to access this page - Added a "success=1" parameter to URL the user is redirected to after making changes on that page to catch those cases bug: 48609 Change-Id: I4f42713ccec647b1d6ff11c2714d645973750579
This commit is contained in:
parent
41bd1fee92
commit
360fc1ffe3
4 changed files with 15 additions and 1 deletions
|
|
@ -110,6 +110,17 @@ class UserrightsPage extends SpecialPage {
|
|||
}
|
||||
|
||||
if ( !$this->userCanChangeRights( $user, true ) ) {
|
||||
if ( $this->isself && $request->getCheck( 'success' ) ) {
|
||||
// bug 48609: if the user just removed its own rights, this would
|
||||
// leads it in a "permissions error" page. In that case, show a
|
||||
// message that it can't anymore use this page instead of an error
|
||||
$this->setHeaders();
|
||||
$out = $this->getOutput();
|
||||
$out->wrapWikiMsg( "<div class=\"successbox\">\n$1\n</div>", 'userrights-removed-self' );
|
||||
$out->returnToMain();
|
||||
return;
|
||||
}
|
||||
|
||||
// @todo FIXME: There may be intermediate groups we can mention.
|
||||
$msg = $user->isAnon() ? 'userrights-nologin' : 'userrights-notallowed';
|
||||
throw new PermissionsError( null, array( array( $msg ) ) );
|
||||
|
|
@ -163,7 +174,7 @@ class UserrightsPage extends SpecialPage {
|
|||
}
|
||||
|
||||
function getSuccessURL() {
|
||||
return $this->getTitle( $this->mTarget )->getFullURL();
|
||||
return $this->getTitle( $this->mTarget )->getFullURL( array( 'success' => 1 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2020,6 +2020,7 @@ Your email address is not revealed when other users contact you.',
|
|||
'userrights-unchangeable-col' => 'Groups you cannot change',
|
||||
'userrights-irreversible-marker' => '$1*', # only translate this message to other languages if you have to change it
|
||||
'userrights-conflict' => 'User rights conflict! Please apply your changes again.',
|
||||
'userrights-removed-self' => 'You successfully removed your own rights. As such, you are no longer able to access this page.',
|
||||
|
||||
# Groups
|
||||
'group' => 'Group:',
|
||||
|
|
|
|||
|
|
@ -2745,6 +2745,7 @@ Parameters:
|
|||
* $1 - optional, for PLURAL use, the number of items in the column following the message. Avoid PLURAL, if your language allows that.',
|
||||
'userrights-irreversible-marker' => '{{optional}}',
|
||||
'userrights-conflict' => "Shown on [[Special:UserRights]] if the target's rights have been changed since the form was loaded.",
|
||||
'userrights-removed-self' => "Shown on [[Special:UserRights]] in a green box after the user removed its own rights to access that page.",
|
||||
|
||||
# Groups
|
||||
'group' => '{{Identical|Group}}',
|
||||
|
|
|
|||
|
|
@ -1146,6 +1146,7 @@ $wgMessageStructure = array(
|
|||
'userrights-unchangeable-col',
|
||||
'userrights-irreversible-marker',
|
||||
'userrights-conflict',
|
||||
'userrights-removed-self',
|
||||
),
|
||||
'group' => array(
|
||||
'group',
|
||||
|
|
|
|||
Loading…
Reference in a new issue