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