From: Aaron Schulz Date: Sat, 17 Jan 2009 23:32:27 +0000 (+0000) Subject: isAllowed('patrol') now returns false if patrolling is disabled X-Git-Tag: 1.31.0-rc.0~43372 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=6fb1c0146d3bbd0c5263d93f38753ddef3dc3f99;p=lhc%2Fweb%2Fwiklou.git isAllowed('patrol') now returns false if patrolling is disabled --- diff --git a/includes/User.php b/includes/User.php index dd823cc6fd..af7871c289 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2086,11 +2086,15 @@ class User { * @param $action \string action to be checked * @return \bool True if action is allowed, else false */ - function isAllowed($action='') { + function isAllowed( $action = '' ) { if ( $action === '' ) - // In the spirit of DWIM - return true; - + return true; // In the spirit of DWIM + # Patrolling may not be enabled + if( $action === 'patrol' || $action === 'autopatrol' ) { + global $wgUseRCPatrol, $wgUseNPPatrol; + if( !$wgUseRCPatrol && !$wgUseNPPatrol ) + return true; + } # Use strict parameter to avoid matching numeric 0 accidentally inserted # by misconfiguration: 0 == 'foo' return in_array( $action, $this->getRights(), true );