r56791 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56790‎ | r56791 | r56792 >
Date:22:30, 22 September 2009
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
* Split out 'deletedcontent' from 'undelete' right (bug 19199/bug 9884)
* Don't blue-link unviewable hidden revisions
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialDeletedContributions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUndelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SkinTemplate.php
@@ -800,7 +800,7 @@
801801 }
802802 } else {
803803 //article doesn't exist or is deleted
804 - if( $wgUser->isAllowed( 'deletedhistory' ) && $wgUser->isAllowed( 'undelete' ) ) {
 804+ if( $wgUser->isAllowed( 'deletedhistory' ) && $wgUser->isAllowed( 'deletedcontent' ) ) {
805805 if( $n = $this->mTitle->isDeleted() ) {
806806 $undelTitle = SpecialPage::getTitleFor( 'Undelete' );
807807 $content_actions['undelete'] = array(
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1353,6 +1353,7 @@
13541354 $wgGroupPermissions['sysop']['delete'] = true;
13551355 $wgGroupPermissions['sysop']['bigdelete'] = true; // can be separately configured for pages with > $wgDeleteRevisionsLimit revs
13561356 $wgGroupPermissions['sysop']['deletedhistory'] = true; // can view deleted history entries, but not see or restore the text
 1357+$wgGroupPermissions['sysop']['deletedcontent'] = true; // can view deleted content
13571358 $wgGroupPermissions['sysop']['undelete'] = true;
13581359 $wgGroupPermissions['sysop']['editinterface'] = true;
13591360 $wgGroupPermissions['sysop']['editusercss'] = true;
Index: trunk/phase3/includes/specials/SpecialUndelete.php
@@ -552,7 +552,7 @@
553553 */
554554 class UndeleteForm {
555555 var $mAction, $mTarget, $mTimestamp, $mRestore, $mInvert, $mTargetObj;
556 - var $mTargetTimestamp, $mAllowed, $mComment, $mToken;
 556+ var $mTargetTimestamp, $mAllowed, $mCanView, $mComment, $mToken;
557557
558558 function UndeleteForm( $request, $par = "" ) {
559559 global $wgUser;
@@ -576,10 +576,15 @@
577577 if( $par != "" ) {
578578 $this->mTarget = $par;
579579 }
580 - if ( $wgUser->isAllowed( 'undelete' ) && !$wgUser->isBlocked() ) {
581 - $this->mAllowed = true;
582 - } else {
 580+ if ( $wgUser->isAllowed( 'deletedcontent' ) && $wgUser->isAllowed( 'undelete' ) && !$wgUser->isBlocked() ) {
 581+ $this->mAllowed = true; // user can restore
 582+ $this->mCanView = true; // user can view content
 583+ } elseif ( $wgUser->isAllowed( 'deletedcontent' ) ) {
 584+ $this->mAllowed = false; // user cannot restore
 585+ $this->mCanView = true; // user can view content
 586+ } else { // user can only view the list of revisions
583587 $this->mAllowed = false;
 588+ $this->mCanView = false;
584589 $this->mTimestamp = '';
585590 $this->mRestore = false;
586591 }
@@ -1136,8 +1141,9 @@
11371142 array( 'page' => $this->mTargetObj->getArticleId() ) );
11381143 $stxt = '';
11391144 $ts = wfTimestamp( TS_MW, $row->ar_timestamp );
 1145+ // Build checkboxen...
11401146 if( $this->mAllowed ) {
1141 - if( $this->mInvert){
 1147+ if( $this->mInvert ) {
11421148 if( in_array( $ts, $this->mTargetTimestamp ) ) {
11431149 $checkBox = Xml::check( "ts$ts");
11441150 } else {
@@ -1146,12 +1152,18 @@
11471153 } else {
11481154 $checkBox = Xml::check( "ts$ts" );
11491155 }
 1156+ } else {
 1157+ $checkBox = '';
 1158+ }
 1159+ // Build page & diff links...
 1160+ if( $this->mCanView ) {
11501161 $titleObj = SpecialPage::getTitleFor( "Undelete" );
1151 - $pageLink = $this->getPageLink( $rev, $titleObj, $ts, $sk );
11521162 # Last link
11531163 if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
 1164+ $pageLink = htmlspecialchars( $wgLang->timeanddate( $ts, true ) );
11541165 $last = wfMsgHtml('diff');
11551166 } else if( $remaining > 0 || ($earliestLiveTime && $ts > $earliestLiveTime) ) {
 1167+ $pageLink = $this->getPageLink( $rev, $titleObj, $ts, $sk );
11561168 $last = $sk->linkKnown(
11571169 $titleObj,
11581170 wfMsgHtml('diff'),
@@ -1163,20 +1175,22 @@
11641176 )
11651177 );
11661178 } else {
 1179+ $pageLink = $this->getPageLink( $rev, $titleObj, $ts, $sk );
11671180 $last = wfMsgHtml('diff');
11681181 }
11691182 } else {
1170 - $checkBox = '';
11711183 $pageLink = htmlspecialchars( $wgLang->timeanddate( $ts, true ) );
11721184 $last = wfMsgHtml('diff');
11731185 }
 1186+ // User links
11741187 $userLink = $sk->revUserTools( $rev );
1175 -
1176 - if(!is_null($size = $row->ar_len)) {
 1188+ // Revision text size
 1189+ if( !is_null($size = $row->ar_len) ) {
11771190 $stxt = $sk->formatRevisionSize( $size );
11781191 }
 1192+ // Edit summary
11791193 $comment = $sk->revComment( $rev );
1180 - $revdlink = '';
 1194+ // Show/hide link
11811195 if( $wgUser->isAllowed( 'deleterevision' ) ) {
11821196 if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
11831197 // If revision was hidden from sysops
@@ -1190,8 +1204,9 @@
11911205 );
11921206 $revdlink = $sk->revDeleteLink( $query, $rev->isDeleted( Revision::DELETED_RESTRICTED ) );
11931207 }
 1208+ } else {
 1209+ $revdlink = '';
11941210 }
1195 -
11961211 return "<li>$checkBox $revdlink ($last) $pageLink . . $userLink $stxt $comment</li>";
11971212 }
11981213
Index: trunk/phase3/includes/specials/SpecialDeletedContributions.php
@@ -145,7 +145,7 @@
146146 $this->messages['undeleteviewlink']
147147 );
148148
149 - if( $wgUser->isAllowed('undelete') ) {
 149+ if( $wgUser->isAllowed('deletedcontent') ) {
150150 $last = $sk->linkKnown(
151151 $undelete,
152152 $this->messages['diff'],

Follow-up revisions

RevisionCommit summaryAuthorDate
r57004Follow-up r56791: add 'deletedcontent' to corerightsaaron02:41, 28 September 2009

Comments

#Comment by Siebrand (talk | contribs)   22:33, 22 September 2009

'right-deletedcontent' message missing in MessagesEn.php (don't forget to update messages.inc, too, please)

#Comment by Aaron Schulz (talk | contribs)   20:40, 29 September 2009

Why is this still tagged?

Status & tagging log