Index: trunk/extensions/AbuseFilter/AbuseFilter.php |
— | — | @@ -78,6 +78,7 @@ |
79 | 79 | $wgAvailableRights[] = 'abusefilter-private'; |
80 | 80 | $wgAvailableRights[] = 'abusefilter-modify-restricted'; |
81 | 81 | $wgAvailableRights[] = 'abusefilter-revert'; |
| 82 | +$wgAvailableRights[] = 'abusefilter-view-private'; |
82 | 83 | |
83 | 84 | $wgLogTypes[] = 'abusefilter'; |
84 | 85 | $wgLogNames['abusefilter'] = 'abusefilter-log-name'; |
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterView.php |
— | — | @@ -17,14 +17,25 @@ |
18 | 18 | |
19 | 19 | function canEdit() { |
20 | 20 | global $wgUser; |
21 | | - static $canEdit = 'unset'; |
| 21 | + static $canEdit = null; |
22 | 22 | |
23 | | - if ($canEdit == 'unset') { |
| 23 | + if ( is_null( $canEdit ) ) { |
24 | 24 | $canEdit = $wgUser->isAllowed( 'abusefilter-modify' ); |
25 | 25 | } |
26 | 26 | |
27 | 27 | return $canEdit; |
28 | 28 | } |
| 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 | + } |
29 | 40 | } |
30 | 41 | |
31 | 42 | class AbuseFilterChangesList extends OldChangesList { |
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php |
— | — | @@ -219,7 +219,7 @@ |
220 | 220 | $wgOut->setSubtitle( wfMsg( 'abusefilter-edit-subtitle', $filter, $history_id ) ); |
221 | 221 | |
222 | 222 | // 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() ) { |
224 | 224 | return wfMsg( 'abusefilter-edit-denied' ); |
225 | 225 | } |
226 | 226 | |
Index: trunk/extensions/AbuseFilter/AbuseFilter.i18n.php |
— | — | @@ -61,6 +61,7 @@ |
62 | 62 | 'right-abusefilter-private' => 'View private data in the abuse log', |
63 | 63 | 'right-abusefilter-modify-restricted' => 'Modify abuse filters with restricted actions', |
64 | 64 | 'right-abusefilter-revert' => 'Revert all changes by a given abuse filter', |
| 65 | + 'right-abusefilter-view-private' => 'View abuse filters marked as private', |
65 | 66 | |
66 | 67 | 'action-abusefilter-modify' => 'modify abuse filters', |
67 | 68 | 'action-abusefilter-view' => 'view abuse filters', |
— | — | @@ -69,6 +70,7 @@ |
70 | 71 | 'action-abusefilter-private' => 'view private data in the abuse log', |
71 | 72 | 'action-abusefilter-modify-restricted' => 'modify abuse filters with restricted actions', |
72 | 73 | 'action-abusefilter-revert' => 'revert all changes by a given abuse filter', |
| 74 | + 'action-abusefilter-view-private' => 'view abuse filters marked as private', |
73 | 75 | |
74 | 76 | // Abuse Log |
75 | 77 | 'abusefilter-log' => 'Abuse filter log', |