Skip to content

Commit

Permalink
[Security] Fix defining multiple roles per access_control rule
Browse files Browse the repository at this point in the history
  • Loading branch information
chalasr committed Nov 9, 2019
1 parent fd7c676 commit 338b3df
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -68,7 +68,14 @@ public function __invoke(RequestEvent $event)
$this->tokenStorage->setToken($token);
}

if (!$this->accessDecisionManager->decide($token, $attributes, $request)) {
$granted = false;
foreach ($attributes as $key => $value) {
if ($this->accessDecisionManager->decide($token, [$key => $value], $request)) {
$granted = true;
}
}

if (!$granted) {
$exception = new AccessDeniedException();
$exception->setAttributes($attributes);
$exception->setSubject($request);
Expand Down

0 comments on commit 338b3df

Please sign in to comment.