File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -105,8 +105,8 @@ edit a particular object. Here's an example implementation:
105
105
106
106
break;
107
107
case self::EDIT:
108
- // we assume that our data object has a method getOwner() to
109
- // get the current owner user entity for this data object
108
+ // this assumes that the data object has a getOwner() method
109
+ // to get the entity of the user who owns this data object
110
110
if ($user->getId() === $post->getOwner()->getId()) {
111
111
return true;
112
112
}
@@ -214,9 +214,7 @@ from the authorization checker is called.
214
214
215
215
$authChecker = $this->get('security.authorization_checker');
216
216
217
- if (false === $authChecker->isGranted('view', $post)) {
218
- throw $this->createAccessDeniedException('Unauthorized access!');
219
- }
217
+ $this->denyAccessUnlessGranted('view', $post, 'Unauthorized access!');
220
218
221
219
return new Response('<h1 >'.$post->getName().'</h1 >');
222
220
}
You can’t perform that action at this time.
0 commit comments