Skip to content

Replaced tabs with white spaces #7487

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
Feb 19, 2017
Merged
Show file tree
Hide file tree
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
17 changes: 8 additions & 9 deletions best_practices/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,15 @@ more advanced use-case, you can always do the same security check in PHP:

if (!$post->isAuthor($this->getUser())) {
$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();
// }
}
// equivalent code without using the "denyAccessUnlessGranted()" shortcut:
//
// use Symfony\Component\Security\Core\Exception\AccessDeniedException;
// ...
//
// if (!$this->get('security.authorization_checker')->isGranted('edit', $post)) {
// throw $this->createAccessDeniedException();
// }

// ...
}
Expand Down
24 changes: 12 additions & 12 deletions doctrine/custom_dql_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ In Symfony, you can register your custom DQL functions as follows:

.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
doctrine:
orm:
# ...
entity_managers:
example_manager:
# Place your functions here
dql:
datetime_functions:
test_datetime: AppBundle\DQL\DatetimeFunction
.. code-block:: yaml

# app/config/config.yml
doctrine:
orm:
# ...
entity_managers:
example_manager:
# Place your functions here
dql:
datetime_functions:
test_datetime: AppBundle\DQL\DatetimeFunction

.. code-block:: xml

Expand Down
35 changes: 18 additions & 17 deletions security/access_denied_handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Each firewall context can define its own custom access denied handler:
));


Your handler must implement the
Your handler must implement the
:class:`Symfony\\Component\\Security\\Http\\Authorization\\AccessDeniedHandlerInterface`.
This interface defines one method called ``handle()`` that implements the logic to
execute when access is denied to the current user (send a mail, log a message, or
Expand Down Expand Up @@ -78,25 +78,26 @@ Then, register the service for the access denied handler:

.. code-block:: xml

<!-- app/config/services.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<!-- app/config/services.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="app.security.access_denied_handler"
class="AppBundle\Security\AccessDeniedHandler" />
</services>
</container>
<services>
<service id="app.security.access_denied_handler"
class="AppBundle\Security\AccessDeniedHandler" />
</services>
</container>

.. code-block:: php

// app/config/services.php
$container->register(
// app/config/services.php
$container->register(
'app.security.access_denied_handler',
'AppBundle\Security\AccessDeniedHandler'
);
'AppBundle\Security\AccessDeniedHandler'
);

That's it! Any ``AccessDeniedException`` thrown by the ``foo`` firewall will now be handled by your service.
That's it! Any ``AccessDeniedException`` thrown by the ``foo`` firewall will now
be handled by your service.