Skip to content

Commit

Permalink
some additional tweaks for the voter cookbook
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jul 4, 2015
1 parent e3cbf35 commit 5d99884
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cookbook/security/voters_data_permission.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ edit a particular object. Here's an example implementation:
break;
case self::EDIT:
// we assume that our data object has a method getOwner() to
// get the current owner user entity for this data object
// this assumes that the data object has a method getOwner()
// to get the entity of the user who owns this data object
if ($user->getId() === $post->getOwner()->getId()) {
return true;
}
Expand Down Expand Up @@ -211,9 +211,7 @@ from the authorization checker is called.
$authChecker = $this->get('security.authorization_checker');
if (false === $authChecker->isGranted('view', $post)) {
throw $this->createAccessDeniedException('Unauthorized access!');
}
$this->denyAccessUnlessGranted('view', $post, 'Unauthorized access!');
return new Response('<h1>'.$post->getName().'</h1>');
}
Expand Down

0 comments on commit 5d99884

Please sign in to comment.