Skip to content

[Security] AccessDeniedException: rename object to subject #19969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ protected function denyAccessUnlessGranted($attributes, $object = null, $message
if (!$this->isGranted($attributes, $object)) {
$exception = $this->createAccessDeniedException($message);
$exception->setAttributes($attributes);
$exception->setObject($object);
$exception->setSubject($object);

throw $exception;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Security/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class AccessDeniedException extends \RuntimeException
{
private $attributes = array();
private $object;
private $subject;

public function __construct($message = 'Access Denied.', \Exception $previous = null)
{
Expand All @@ -45,16 +45,16 @@ public function setAttributes($attributes)
/**
* @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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function handle(GetResponseEvent $event)
if (!$this->accessDecisionManager->decide($token, $attributes, $request)) {
$exception = new AccessDeniedException();
$exception->setAttributes($attributes);
$exception->setObject($request);
$exception->setSubject($request);

throw $exception;
}
Expand Down