Skip to content

Commit f9173ea

Browse files
committed
minor symfony#23201 Change wording from object to subject (greg0ire)
This PR was merged into the 3.4 branch. Discussion ---------- Change wording from object to subject | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget updating UPGRADE-*.md files --> | Tests pass? | yes | License | MIT The authorization checker has been changed to support any value recently. The naming should reflect that to avoid confusion. Refs sonata-project/SonataAdminBundle#4518 Commits ------- d261894 Change wording from object to subject
2 parents 886df99 + d261894 commit f9173ea

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,40 +159,40 @@ protected function addFlash($type, $message)
159159
}
160160

161161
/**
162-
* Checks if the attributes are granted against the current authentication token and optionally supplied object.
162+
* Checks if the attributes are granted against the current authentication token and optionally supplied subject.
163163
*
164164
* @param mixed $attributes The attributes
165-
* @param mixed $object The object
165+
* @param mixed $subject The subject
166166
*
167167
* @return bool
168168
*
169169
* @throws \LogicException
170170
*/
171-
protected function isGranted($attributes, $object = null)
171+
protected function isGranted($attributes, $subject = null)
172172
{
173173
if (!$this->container->has('security.authorization_checker')) {
174174
throw new \LogicException('The SecurityBundle is not registered in your application.');
175175
}
176176

177-
return $this->container->get('security.authorization_checker')->isGranted($attributes, $object);
177+
return $this->container->get('security.authorization_checker')->isGranted($attributes, $subject);
178178
}
179179

180180
/**
181181
* Throws an exception unless the attributes are granted against the current authentication token and optionally
182-
* supplied object.
182+
* supplied subject.
183183
*
184184
* @param mixed $attributes The attributes
185-
* @param mixed $object The object
185+
* @param mixed $subject The subject
186186
* @param string $message The message passed to the exception
187187
*
188188
* @throws AccessDeniedException
189189
*/
190-
protected function denyAccessUnlessGranted($attributes, $object = null, $message = 'Access Denied.')
190+
protected function denyAccessUnlessGranted($attributes, $subject = null, $message = 'Access Denied.')
191191
{
192-
if (!$this->isGranted($attributes, $object)) {
192+
if (!$this->isGranted($attributes, $subject)) {
193193
$exception = $this->createAccessDeniedException($message);
194194
$exception->setAttributes($attributes);
195-
$exception->setSubject($object);
195+
$exception->setSubject($subject);
196196

197197
throw $exception;
198198
}

src/Symfony/Component/Security/Core/Authorization/AuthorizationChecker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM
5151
*
5252
* @throws AuthenticationCredentialsNotFoundException when the token storage has no authentication token.
5353
*/
54-
final public function isGranted($attributes, $object = null)
54+
final public function isGranted($attributes, $subject = null)
5555
{
5656
if (null === ($token = $this->tokenStorage->getToken())) {
5757
throw new AuthenticationCredentialsNotFoundException('The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL.');
@@ -65,6 +65,6 @@ final public function isGranted($attributes, $object = null)
6565
$attributes = array($attributes);
6666
}
6767

68-
return $this->accessDecisionManager->decide($token, $attributes, $object);
68+
return $this->accessDecisionManager->decide($token, $attributes, $subject);
6969
}
7070
}

src/Symfony/Component/Security/Core/Authorization/AuthorizationCheckerInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
interface AuthorizationCheckerInterface
2020
{
2121
/**
22-
* Checks if the attributes are granted against the current authentication token and optionally supplied object.
22+
* Checks if the attributes are granted against the current authentication token and optionally supplied subject.
2323
*
2424
* @param mixed $attributes
25-
* @param mixed $object
25+
* @param mixed $subject
2626
*
2727
* @return bool
2828
*/
29-
public function isGranted($attributes, $object = null);
29+
public function isGranted($attributes, $subject = null);
3030
}

0 commit comments

Comments
 (0)