r56591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56590‎ | r56591 | r56592 >
Date:10:05, 18 September 2009
Author:werdna
Status:ok
Tags:
Comment:
AbuseFilter: Show permissions errors on new filter and importing a filter when the user does not have permission.
Resolves bug 20467
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.i18n.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewImport.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewImport.php
@@ -5,6 +5,12 @@
66 function show( ) {
77 global $wgOut;
88
 9+ global $wgUser;
 10+ if ( !$wgUser->isAllowed( 'abusefilter-modify' ) ) {
 11+ $wgOut->addWikiMsg( 'abusefilter-edit-notallowed' );
 12+ return;
 13+ }
 14+
915 $wgOut->addWikiMsg( 'abusefilter-import-intro' );
1016
1117 $html = Xml::textarea( 'wpImportText', '', 40, 20 );
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php
@@ -17,6 +17,11 @@
1818 $filter = $this->mFilter;
1919 $history_id = $this->mHistoryID;
2020 $this->mSkin = $wgUser->getSkin();
 21+
 22+ if ( $filter == 'new' && !$wgUser->isAllowed( 'abusefilter-modify' ) ) {
 23+ $wgOut->addWikiMsg( 'abusefilter-edit-notallowed' );
 24+ return;
 25+ }
2126
2227 $editToken = $wgRequest->getVal( 'wpEditToken' );
2328 $didEdit = $this->canEdit()
Index: trunk/extensions/AbuseFilter/AbuseFilter.i18n.php
@@ -222,6 +222,7 @@
223223 'abusefilter-edit-syntaxerr' => 'Syntax error detected: $1',
224224 'abusefilter-edit-bad-tags' => 'One or more of the tags you specified is not valid.
225225 Tags should be short, and they should not contain special characters.',
 226+ 'abusefilter-edit-notallowed' => 'You are not permitted to create or edit abuse filters',
226227
227228 // Filter editing helpers
228229 'abusefilter-edit-builder-select' => 'Select an option to add it at the cursor',

Status & tagging log