Skip to content

Commit 726b4e8

Browse files
author
Grégoire Paris
committed
Change wording from object to subject
The authorization checker has been changed to support any value recently. The naming should reflect that to avoid confusion. Refs sonata-project/SonataAdminBundle#4518
1 parent 4868186 commit 726b4e8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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
}

0 commit comments

Comments
 (0)