AccessDeniedException: rename object to subject

With this change the name is inline with what we use in the base voter
interface.
This commit is contained in:
Christian Flothmann 2016-09-19 13:01:06 +02:00
parent a86583d226
commit 9603ffa458
4 changed files with 9 additions and 9 deletions

View File

@ -194,7 +194,7 @@ abstract class Controller implements ContainerAwareInterface
if (!$this->isGranted($attributes, $object)) {
$exception = $this->createAccessDeniedException($message);
$exception->setAttributes($attributes);
$exception->setObject($object);
$exception->setSubject($object);
throw $exception;
}

View File

@ -4,7 +4,7 @@ CHANGELOG
3.2.0
-----
* added `attributes` and `object` with getters/setters to `Symfony\Component\Security\Core\Exception\AccessDeniedException`
* added `$attributes` and `$subject` with getters/setters to `Symfony\Component\Security\Core\Exception\AccessDeniedException`
3.0.0
-----

View File

@ -19,7 +19,7 @@ namespace Symfony\Component\Security\Core\Exception;
class AccessDeniedException extends \RuntimeException
{
private $attributes = array();
private $object;
private $subject;
public function __construct($message = 'Access Denied.', \Exception $previous = null)
{
@ -45,16 +45,16 @@ class AccessDeniedException extends \RuntimeException
/**
* @return mixed
*/
public function getObject()
public function getSubject()
{
return $this->object;
return $this->subject;
}
/**
* @param mixed $object
* @param mixed $subject
*/
public function setObject($object)
public function setSubject($subject)
{
$this->object = $object;
$this->subject = $subject;
}
}

View File

@ -69,7 +69,7 @@ class AccessListener implements ListenerInterface
if (!$this->accessDecisionManager->decide($token, $attributes, $request)) {
$exception = new AccessDeniedException();
$exception->setAttributes($attributes);
$exception->setObject($request);
$exception->setSubject($request);
throw $exception;
}