Skip to content

Commit

Permalink
Performance improvement: SecurityVoter implements supportsAttribute f…
Browse files Browse the repository at this point in the history
…rom Symfony\Component\Security\Core\Authorization\Voter\CacheableVoterInterface which allows the access decision manager to cache the supported attributes by the voter
  • Loading branch information
rneuter committed Nov 16, 2023
1 parent ed2cbbc commit fb94a20
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Security/SecurityVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public function __construct(AuthorizationCheckerInterface $authorizationChecker,
}

protected function supports(string $permissionName, mixed $subject): bool
{
return $this->supportsAttribute($permissionName);
}

public function supportsAttribute(string $permissionName): bool
{
return Permission::exists($permissionName);
}
Expand Down

0 comments on commit fb94a20

Please sign in to comment.