Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit11aead7

Browse files
Michael Kleinweaverryan
Michael Klein
authored andcommitted
simplified the example
1 parent8227270 commit11aead7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

‎cookbook/security/voters_data_permission.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,14 @@ from the security context is called.
192192
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
193193
use Symfony\Component\HttpFoundation\Response;
194194
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
195-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
196-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
197-
use Acme\DemoBundle\Entity\Post;
198195
199196
class PostController extends Controller
200197
{
201-
/**
202-
* @Route("/blog/{id}")
203-
* @ParamConverter("post", class="SensioBlogBundle:Post")
204-
*/
205-
public function showAction(Post $post)
198+
public function showAction()
206199
{
200+
// get a Post instance
201+
$post = ...;
202+
207203
// keep in mind, this will call all registered security voters
208204
if (false === $this->get('security.context')->isGranted('view', $post)) {
209205
throw new AccessDeniedException('Unauthorised access!');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp