r110906 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110905‎ | r110906 | r110907 >
Date:01:02, 8 February 2012
Author:werdna
Status:ok
Tags:
Comment:
(bug 33392) Fix issue where users without permission to add restricted actions could nonetheless remove them. Patch by Nikola Kovacs, with modifications for code style.
Modified paths:
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php
@@ -53,6 +53,7 @@
5454 array( $newRow->mOriginalRow, $newRow->mOriginalActions )
5555 );
5656
 57+ $origActions = $newRow->mOriginalActions;
5758 unset( $newRow->mOriginalRow );
5859 unset( $newRow->mOriginalActions );
5960
@@ -64,12 +65,18 @@
6566
6667 // Check for restricted actions
6768 global $wgAbuseFilterRestrictedActions;
 69+ $allActions = array_keys( array_merge(
 70+ array_filter( $actions ),
 71+ array_filter( $origActions )
 72+ ) );
 73+
6874 if (
69 - array_intersect(
70 - $wgAbuseFilterRestrictedActions,
71 - array_keys( array_filter( $actions ) ) )
72 - && !$user->isAllowed( 'abusefilter-modify-restricted' ) )
73 - {
 75+ count( array_intersect(
 76+ $wgAbuseFilterRestrictedActions,
 77+ $allActions
 78+ ) )
 79+ && !$user->isAllowed( 'abusefilter-modify-restricted' )
 80+ ) {
7481 $out->addHTML(
7582 $this->buildFilterEditor(
7683 wfMsgExt( 'abusefilter-edit-restricted', 'parse' ),

Status & tagging log