Skip to content

Commit

Permalink
Remove unnecessary variable and use correct group method
Browse files Browse the repository at this point in the history
  • Loading branch information
malberts committed Nov 8, 2021
1 parent d0baea2 commit 700d2b5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/PermissionsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,16 @@ protected function userHas( $attributeOfUser, $attributeNameInDomElement ) {
}

$expectedValues = $this->getValueListFromAttribute( $attributeNameInDomElement );
$services = MediaWikiServices::getInstance();
switch ( $attributeOfUser ) {
case 'group':
$observedValues = $services->getUserGroupManager()->getUserGroups( $user );
$observedValues = MediaWikiServices::getInstance()
->getUserGroupManager()
->getUserEffectiveGroups( $user );
break;
case 'permission';
$observedValues = $services->getPermissionManager()->getUserPermissions( $user );
$observedValues = MediaWikiServices::getInstance()
->getPermissionManager()
->getUserPermissions( $user );
break;
}
$effectiveValues = array_intersect( $expectedValues, $observedValues );
Expand Down

0 comments on commit 700d2b5

Please sign in to comment.