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

Appearance settings

[BestPractices][Security] revert #5271 on the 2.6 branch #5305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
revert #5271 on the 2.6 branch
  • Loading branch information
xabbuh committed May 23, 2015
commit adf6f36231745098effe542f40bcd61ba68c1865
22 changes: 13 additions & 9 deletions 22 best_practices/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,6 @@ more advanced use-case, you can always do the same security check in PHP:

.. code-block:: php

use Symfony\Component\Security\Core\Exception\AccessDeniedException;

// ...

/**
* @Route("/{id}/edit", name="admin_post_edit")
*/
Expand All @@ -238,7 +234,16 @@ more advanced use-case, you can always do the same security check in PHP:
}

if (!$post->isAuthor($this->getUser())) {
throw new AccessDeniedException();
$this->denyAccessUnlessGranted('edit', $post);

// or without the shortcut:
//
// use Symfony\Component\Security\Core\Exception\AccessDeniedException;
// ...
//
// if (!$this->get('security.authorization_checker')->isGranted('edit', $post)) {
// throw $this->createAccessDeniedException();
// }
}

// ...
Expand Down Expand Up @@ -327,10 +332,6 @@ via the even easier shortcut in a controller:

.. code-block:: php

use Symfony\Component\Security\Core\Exception\AccessDeniedException;

// ...

/**
* @Route("/{id}/edit", name="admin_post_edit")
*/
Expand All @@ -342,6 +343,9 @@ via the even easier shortcut in a controller:

// or without the shortcut:
//
// use Symfony\Component\Security\Core\Exception\AccessDeniedException;
// ...
//
// if (!$this->get('security.authorization_checker')->isGranted('edit', $post)) {
// throw $this->createAccessDeniedException();
// }
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.