Page MenuHomePhabricator

Move remaining user rights methods to PermissionManager
Open, Needs TriagePublic

Description

Note: this is a followup to T218558: Move User::getRights and related methods into PermissionManager

The following methods in the User class check the user's permissions using deprecated wrappers for PermissionManager methods. The methods should be a part of the PermissionManager class.

public function useRCPatrol() {
	global $wgUseRCPatrol;
	return $wgUseRCPatrol && $this->isAllowedAny( 'patrol', 'patrolmarks' );
}

public function useNPPatrol() {
	global $wgUseRCPatrol, $wgUseNPPatrol;
	return (
		( $wgUseRCPatrol || $wgUseNPPatrol )
			&& ( $this->isAllowedAny( 'patrol', 'patrolmarks' ) )
	);
}

public function useFilePatrol() {
	global $wgUseRCPatrol, $wgUseFilePatrol;
	return (
		( $wgUseRCPatrol || $wgUseFilePatrol )
			&& ( $this->isAllowedAny( 'patrol', 'patrolmarks' ) )
	);
}

public function isNewbie() {
	return !$this->isAllowed( 'autoconfirmed' );
}

Moving these would also allow injecting the globals

Event Timeline

DannyS712 created this task.May 5 2020, 2:30 AM
Restricted Application added a project: User-DannyS712. · View Herald TranscriptMay 5 2020, 2:30 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 moved this task from Unsorted to Next on the User-DannyS712 board.May 5 2020, 2:31 AM

Change 595802 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Move remaining user rights methods to PermissionManager

https://gerrit.wikimedia.org/r/595802

@Krinkle you left a -1 on the patch; can you take a look at my response regarding scope creep?