diff --git a/src/Plugin/Condition/UserHasRole.php b/src/Plugin/Condition/UserHasRole.php index 46c1166..ff7d499 100644 --- a/src/Plugin/Condition/UserHasRole.php +++ b/src/Plugin/Condition/UserHasRole.php @@ -50,17 +50,12 @@ class UserHasRole extends RulesConditionBase { * TRUE if the user has the role(s). */ protected function doEvaluate(UserInterface $account, array $roles, $operation = 'AND') { - - $rids = array_map(function ($role) { - return $role->id(); - }, $roles); - switch ($operation) { case 'OR': - return (bool) array_intersect($rids, $account->getRoles()); + return (bool) array_intersect($roles, $account->getRoles()); case 'AND': - return (bool) !array_diff($rids, $account->getRoles()); + return (bool) !array_diff($roles, $account->getRoles()); default: throw new InvalidArgumentException('Either use "AND" or "OR". Leave empty for default "AND" behavior.');