fix: clarify parameter name to comply with deprecations from #34074

This commit is contained in:
Dennis Langen 2020-08-18 13:16:15 +02:00 committed by Fabien Potencier
parent 56bf1bca49
commit 91249ed0bf
2 changed files with 8 additions and 8 deletions

View File

@ -207,30 +207,30 @@ abstract class AbstractController implements ServiceSubscriberInterface
}
/**
* Checks if the attributes are granted against the current authentication token and optionally supplied subject.
* Checks if the attribute is granted against the current authentication token and optionally supplied subject.
*
* @throws \LogicException
*/
protected function isGranted($attributes, $subject = null): bool
protected function isGranted($attribute, $subject = null): bool
{
if (!$this->container->has('security.authorization_checker')) {
throw new \LogicException('The SecurityBundle is not registered in your application. Try running "composer require symfony/security-bundle".');
}
return $this->container->get('security.authorization_checker')->isGranted($attributes, $subject);
return $this->container->get('security.authorization_checker')->isGranted($attribute, $subject);
}
/**
* Throws an exception unless the attributes are granted against the current authentication token and optionally
* Throws an exception unless the attribute is granted against the current authentication token and optionally
* supplied subject.
*
* @throws AccessDeniedException
*/
protected function denyAccessUnlessGranted($attributes, $subject = null, string $message = 'Access Denied.'): void
protected function denyAccessUnlessGranted($attribute, $subject = null, string $message = 'Access Denied.'): void
{
if (!$this->isGranted($attributes, $subject)) {
if (!$this->isGranted($attribute, $subject)) {
$exception = $this->createAccessDeniedException($message);
$exception->setAttributes($attributes);
$exception->setAttributes($attribute);
$exception->setSubject($subject);
throw $exception;

View File

@ -19,7 +19,7 @@ namespace Symfony\Component\Security\Core\Authorization;
interface AuthorizationCheckerInterface
{
/**
* Checks if the attributes are granted against the current authentication token and optionally supplied subject.
* Checks if the attribute is granted against the current authentication token and optionally supplied subject.
*
* @param mixed $attribute A single attribute to vote on (can be of any type, string and instance of Expression are supported by the core)
* @param mixed $subject