r52743 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52742‎ | r52743 | r52744 >
Date:14:17, 3 July 2009
Author:werdna
Status:deferred
Tags:
Comment:
Add abusefilter-view-private right for viewing private abuse filters. Patch by Haza-w with stylistic and other minor adjustments
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.i18n.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilter.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterView.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.php
@@ -78,6 +78,7 @@
7979 $wgAvailableRights[] = 'abusefilter-private';
8080 $wgAvailableRights[] = 'abusefilter-modify-restricted';
8181 $wgAvailableRights[] = 'abusefilter-revert';
 82+$wgAvailableRights[] = 'abusefilter-view-private';
8283
8384 $wgLogTypes[] = 'abusefilter';
8485 $wgLogNames['abusefilter'] = 'abusefilter-log-name';
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterView.php
@@ -17,14 +17,25 @@
1818
1919 function canEdit() {
2020 global $wgUser;
21 - static $canEdit = 'unset';
 21+ static $canEdit = null;
2222
23 - if ($canEdit == 'unset') {
 23+ if ( is_null( $canEdit ) ) {
2424 $canEdit = $wgUser->isAllowed( 'abusefilter-modify' );
2525 }
2626
2727 return $canEdit;
2828 }
 29+
 30+ function canViewPrivate() {
 31+ global $wgUser;
 32+ static $canView = null;
 33+
 34+ if ( is_null( $canView ) ) {
 35+ $canView = $this->canEdit() || $wgUser->isAllowed( 'abusefilter-view-private' );
 36+ }
 37+
 38+ return $canView;
 39+ }
2940 }
3041
3142 class AbuseFilterChangesList extends OldChangesList {
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php
@@ -219,7 +219,7 @@
220220 $wgOut->setSubtitle( wfMsg( 'abusefilter-edit-subtitle', $filter, $history_id ) );
221221
222222 // Hide hidden filters.
223 - if (isset($row->af_hidden) && $row->af_hidden && !$this->canEdit()) {
 223+ if ( isset($row->af_hidden) && $row->af_hidden && !$this->canViewPrivate() ) {
224224 return wfMsg( 'abusefilter-edit-denied' );
225225 }
226226
Index: trunk/extensions/AbuseFilter/AbuseFilter.i18n.php
@@ -61,6 +61,7 @@
6262 'right-abusefilter-private' => 'View private data in the abuse log',
6363 'right-abusefilter-modify-restricted' => 'Modify abuse filters with restricted actions',
6464 'right-abusefilter-revert' => 'Revert all changes by a given abuse filter',
 65+ 'right-abusefilter-view-private' => 'View abuse filters marked as private',
6566
6667 'action-abusefilter-modify' => 'modify abuse filters',
6768 'action-abusefilter-view' => 'view abuse filters',
@@ -69,6 +70,7 @@
7071 'action-abusefilter-private' => 'view private data in the abuse log',
7172 'action-abusefilter-modify-restricted' => 'modify abuse filters with restricted actions',
7273 'action-abusefilter-revert' => 'revert all changes by a given abuse filter',
 74+ 'action-abusefilter-view-private' => 'view abuse filters marked as private',
7375
7476 // Abuse Log
7577 'abusefilter-log' => 'Abuse filter log',

Status & tagging log