(bug 37926) Split 'deleterevision' right for log entries

This change adds a new permission ('deletelogentry') which is required to be able
to delete log entries.

It does not affect who can see deleted content.

Change-Id: I6b69919a1bdc502becc1ae4ac9169b8b0e85bfdc
This commit is contained in:
Alex Monk 2012-06-25 17:07:51 +01:00
parent 85f3f3d7b6
commit 747e89ed57
9 changed files with 30 additions and 6 deletions

View file

@ -97,6 +97,8 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki.
* (bug 36783) Implement jQuery Promise interface in mediawiki.api module.
* Make dates in sortable tables sort according to the page content language
instead of the site content language
* (bug 37926) Deleterevision will no longer allow users to delete log entries,
the new deletelogentry permission is required for this.
=== Bug fixes in 1.20 ===
* (bug 30245) Use the correct way to construct a log page title.

View file

@ -3781,6 +3781,7 @@ $wgGroupPermissions['bureaucrat']['noratelimit'] = true;
// Permission to export pages including linked pages regardless of $wgExportMaxLinkDepth
#$wgGroupPermissions['bureaucrat']['override-export-depth'] = true;
#$wgGroupPermissions['sysop']['deletelogentry'] = true;
#$wgGroupPermissions['sysop']['deleterevision'] = true;
// To hide usernames from users and Sysops
#$wgGroupPermissions['suppress']['hideuser'] = true;

View file

@ -119,6 +119,7 @@ class User {
'delete',
'deletedhistory',
'deletedtext',
'deletelogentry',
'deleterevision',
'edit',
'editinterface',

View file

@ -493,9 +493,9 @@ class LogEventsList extends ContextSource {
}
$del = '';
$user = $this->getUser();
// Don't show useless checkbox to people who cannot hide revisions
// Don't show useless checkbox to people who cannot hide log entries
if( $user->isAllowed( 'deletedhistory' ) ) {
if( $row->log_deleted || $user->isAllowed( 'deleterevision' ) ) {
if( $row->log_deleted || $user->isAllowed( 'deletelogentry' ) ) {
$canHide = $user->isAllowed( 'deleterevision' );
if ( $this->flags & self::USE_REVDEL_CHECKBOXES ) { // Show checkboxes instead of links.
if ( !self::userCan( $row, LogPage::DELETED_RESTRICTED, $user ) ) { // If event was hidden from sysops

View file

@ -161,8 +161,8 @@ class SpecialLog extends SpecialPage {
}
private function getRevisionButton( $formcontents ) {
# If the user doesn't have the ability to delete revisions, don't bother showing him/her the button.
if ( !$this->getUser()->isAllowed( 'deleterevision' ) ) {
# If the user doesn't have the ability to delete log entries, don't bother showing him/her the button.
if ( !$this->getUser()->isAllowed( 'deletelogentry' ) ) {
return $formcontents;
}

View file

@ -66,6 +66,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
'success' => 'revdelete-success',
'failure' => 'revdelete-failure',
'list-class' => 'RevDel_RevisionList',
'permission' => 'deleterevision',
),
'archive' => array(
'check-label' => 'revdelete-hide-text',
@ -73,6 +74,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
'success' => 'revdelete-success',
'failure' => 'revdelete-failure',
'list-class' => 'RevDel_ArchiveList',
'permission' => 'deleterevision',
),
'oldimage'=> array(
'check-label' => 'revdelete-hide-image',
@ -80,6 +82,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
'success' => 'revdelete-success',
'failure' => 'revdelete-failure',
'list-class' => 'RevDel_FileList',
'permission' => 'deleterevision',
),
'filearchive' => array(
'check-label' => 'revdelete-hide-image',
@ -87,6 +90,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
'success' => 'revdelete-success',
'failure' => 'revdelete-failure',
'list-class' => 'RevDel_ArchivedFileList',
'permission' => 'deleterevision',
),
'logging' => array(
'check-label' => 'revdelete-hide-name',
@ -94,6 +98,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
'success' => 'logdelete-success',
'failure' => 'logdelete-failure',
'list-class' => 'RevDel_LogList',
'permission' => 'deletelogentry',
),
);
@ -117,7 +122,6 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
$output = $this->getOutput();
$user = $this->getUser();
$this->mIsAllowed = $user->isAllowed('deleterevision'); // for changes
$this->setHeaders();
$this->outputHeader();
$request = $this->getRequest();
@ -163,6 +167,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
return;
}
$this->typeInfo = self::$allowedTypes[$this->typeName];
$this->mIsAllowed = $user->isAllowed( $this->typeInfo['permission'] );
# If we have revisions, get the title from the first one
# since they should all be from the same page. This allows

View file

@ -1985,6 +1985,7 @@ Your e-mail address is not revealed when other users contact you.',
'right-writeapi' => 'Use of the write API',
'right-delete' => 'Delete pages',
'right-bigdelete' => 'Delete pages with large histories',
'right-deletelogentry' => 'Delete and undelete specific log entries',
'right-deleterevision' => 'Delete and undelete specific revisions of pages',
'right-deletedhistory' => 'View deleted history entries, without their associated text',
'right-deletedtext' => 'View deleted text and changes between deleted revisions',

View file

@ -1655,6 +1655,15 @@ If someone with this right (bots by default) edits a user talk page and marks it
'right-writeapi' => '{{doc-right|writeapi}}',
'right-delete' => '{{doc-right|delete}}',
'right-bigdelete' => '{{doc-right|bigdelete}}',
'right-deletelogentry' => '{{doc-right|deletelogentry}}
This user right is part of the [[mw:RevisionDelete|RevisionDelete]] feature.
It can be given to the group {{msg|group-sysop|pl=yes}}, although this right is disabled by default.
See also
* {{msg|right-suppressionlog|pl=yes}}
* {{msg|right-hideuser|pl=yes}}
* {{msg|right-suppressrevision|pl=yes}}
* {{msg|right-deleterevision|pl=yes}}',
'right-deleterevision' => '{{doc-right|deleterevision}}
This user right is part of the [[mw:RevisionDelete|RevisionDelete]] feature.
It can be given to the group {{msg|group-sysop|pl=yes}}, although this right is disabled by default.
@ -1662,7 +1671,8 @@ It can be given to the group {{msg|group-sysop|pl=yes}}, although this right is
See also
* {{msg|right-suppressionlog|pl=yes}}
* {{msg|right-hideuser|pl=yes}}
* {{msg|right-suppressrevision|pl=yes}}',
* {{msg|right-suppressrevision|pl=yes}}
* {{msg|right-deletelogentry|pl=yes}}',
'right-deletedhistory' => '{{doc-right|deletedhistory}}',
'right-deletedtext' => '{{doc-right|deletedtext}}',
'right-browsearchive' => '{{doc-right|browsearchive}}',
@ -1674,6 +1684,7 @@ It can be given to the group {{msg|group-suppress|pl=yes}}, although that group
See also
* {{msg|right-suppressionlog|pl=yes}}
* {{msg|right-hideuser|pl=yes}}
* {{msg|right-deletelogentry|pl=yes}}
* {{msg|right-deleterevision|pl=yes}}',
'right-suppressionlog' => '{{doc-right|suppressionlog}}
This user right is part of the [[mw:RevisionDelete|RevisionDelete]] feature.
@ -1682,6 +1693,7 @@ It can be given to the group {{msg|group-suppress|pl=yes}}, although that group
See also
* {{msg|right-suppressrevision|pl=yes}}
* {{msg|right-hideuser|pl=yes}}
* {{msg|right-deletelogentry|pl=yes}}
* {{msg|right-deleterevision|pl=yes}}',
'right-block' => '{{doc-right|block}}',
'right-blockemail' => '{{doc-right|blockemail}}',
@ -1692,6 +1704,7 @@ It can be given to the group {{msg|group-suppress|pl=yes}}, although that group
See also
* {{msg|right-suppressionlog|pl=yes}}
* {{msg|right-suppressrevision|pl=yes}}
* {{msg|right-deletelogentry|pl=yes}}
* {{msg|right-deleterevision|pl=yes}}',
'right-ipblock-exempt' => '{{doc-right|ipblock-exempt}}
This user automatically bypasses IP blocks, auto-blocks and range blocks - so I presume - but I am uncertain',

View file

@ -1134,6 +1134,7 @@ $wgMessageStructure = array(
'right-writeapi',
'right-delete',
'right-bigdelete',
'right-deletelogentry',
'right-deleterevision',
'right-deletedhistory',
'right-deletedtext',