(bug 15945) API: Use User::useRCPatrol() and useNPPatrol() rather than isAllowed('patrol') in list=recentchanges

This commit is contained in:
Roan Kattouw 2008-10-14 12:46:11 +00:00
parent e7dabc458d
commit abd56027c8
2 changed files with 5 additions and 3 deletions

View file

@ -325,6 +325,8 @@ The following extensions are migrated into MediaWiki 1.14:
manipulation of legacy pages with invalid titles possible
* (bug 15881) Empty or invalid parameters cause database errors
* The maxage and smaxage parameters are now properly validated
* (bug 15945) list=recentchanges doesn't check $wgUseRCPatrol, $wgUseNPPatrol
and patrolmarks right
=== Languages updated in 1.14 ===

View file

@ -67,7 +67,7 @@ class ApiQueryRecentChanges extends ApiQueryBase {
public static function getPatrolToken($pageid, $title, $rc)
{
global $wgUser;
if(!$wgUser->isAllowed('patrol'))
if(!$wgUser->useRCPatrol() && !$wgUser->useNPPatrol())
return false;
// The patrol token is always the same, let's exploit that
@ -138,7 +138,7 @@ class ApiQueryRecentChanges extends ApiQueryBase {
// Check permissions
global $wgUser;
if((isset($show['patrolled']) || isset($show['!patrolled'])) && !$wgUser->isAllowed('patrol'))
if((isset($show['patrolled']) || isset($show['!patrolled'])) && !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol())
$this->dieUsage("You need the patrol right to request the patrolled flag", 'permissiondenied');
/* Add additional conditions to query depending upon parameters. */
@ -183,7 +183,7 @@ class ApiQueryRecentChanges extends ApiQueryBase {
$this->fld_loginfo = isset($prop['loginfo']);
global $wgUser;
if($this->fld_patrolled && !$wgUser->isAllowed('patrol'))
if($this->fld_patrolled && !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol())
$this->dieUsage("You need the patrol right to request the patrolled flag", 'permissiondenied');
/* Add fields to our query if they are specified as a needed parameter. */