Skip to content

[Security] Fix the SecurityBundle\Security.php helper namespace #17386

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
Oct 22, 2022
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
4 changes: 2 additions & 2 deletions form/dynamic_form_modification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ The problem is now to get the current user and create a choice field that
contains only this user's friends. This can be done by injecting the ``Security``
service into the form type so you can get the current user object::

use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Bundle\SecurityBundle\Security;
// ...

class FriendMessageFormType extends AbstractType
Expand All @@ -260,7 +260,7 @@ security helper to fill in the listener logic::
use App\Entity\User;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
// ...
Expand Down
28 changes: 14 additions & 14 deletions security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -598,12 +598,12 @@ Fetching the Firewall Configuration for a Request
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you need to get the configuration of the firewall that matched a given request,
use the :class:`Symfony\\Bundle\\SecurityBundle\\Security\\Security` service::
use the :class:`Symfony\\Bundle\\SecurityBundle\\Security` service::

// src/Service/ExampleService.php
// ...

use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\RequestStack;

class ExampleService
Expand Down Expand Up @@ -1609,23 +1609,23 @@ Login Programmatically

.. versionadded:: 6.2

The :class:`Symfony\Bundle\SecurityBundle\Security\Security <Symfony\\Bundle\\SecurityBundle\\Security\\Security>`
The :class:`Symfony\Bundle\SecurityBundle\Security <Symfony\\Bundle\\SecurityBundle\\Security>`
class was introduced in Symfony 6.2. Prior to 6.2, it was called
``Symfony\Component\Security\Core\Security``.

.. versionadded:: 6.2

The :method:`Symfony\\Bundle\\SecurityBundle\\Security\\Security::login`
The :method:`Symfony\\Bundle\\SecurityBundle\\Security::login`
method was introduced in Symfony 6.2.

You can log in a user programmatically using the `login()` method of the
:class:`Symfony\\Bundle\\SecurityBundle\\Security\\Security` helper::
:class:`Symfony\\Bundle\\SecurityBundle\\Security` helper::

// src/Controller/SecurityController.php
namespace App\Controller\SecurityController;

use App\Security\Authenticator\ExampleAuthenticator;
use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Bundle\SecurityBundle\Security;

class SecurityController
{
Expand Down Expand Up @@ -1779,22 +1779,22 @@ Logout programmatically

.. versionadded:: 6.2

The :class:`Symfony\Bundle\SecurityBundle\Security\Security <Symfony\\Bundle\\SecurityBundle\\Security\\Security>`
The :class:`Symfony\Bundle\SecurityBundle\Security <Symfony\\Bundle\\SecurityBundle\\Security>`
class was introduced in Symfony 6.2. Prior to 6.2, it was called
``Symfony\Component\Security\Core\Security``.

.. versionadded:: 6.2

The :method:`Symfony\\Bundle\\SecurityBundle\\Security\\Security::logout`
The :method:`Symfony\\Bundle\\SecurityBundle\\Security::logout`
method was introduced in Symfony 6.2.

You can logout user programmatically using the ``logout()`` method of the
:class:`Symfony\\Bundle\\SecurityBundle\\Security\\Security` helper::
:class:`Symfony\\Bundle\\SecurityBundle\\Security` helper::

// src/Controller/SecurityController.php
namespace App\Controller\SecurityController;

use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Bundle\SecurityBundle\Security;

class SecurityController
{
Expand Down Expand Up @@ -1896,12 +1896,12 @@ Fetching the User from a Service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you need to get the logged in user from a service, use the
:class:`Symfony\\Bundle\\SecurityBundle\\Security\\Security` service::
:class:`Symfony\\Bundle\\SecurityBundle\\Security` service::

// src/Service/ExampleService.php
// ...

use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Bundle\SecurityBundle\Security;

class ExampleService
{
Expand All @@ -1925,7 +1925,7 @@ If you need to get the logged in user from a service, use the

.. versionadded:: 6.2

The :class:`Symfony\\Bundle\\SecurityBundle\\Security\\Security` class
The :class:`Symfony\\Bundle\\SecurityBundle\\Security` class
was introduced in Symfony 6.2. In previous Symfony versions this class was
defined in ``Symfony\Component\Security\Core\Security``.

Expand Down Expand Up @@ -2333,7 +2333,7 @@ want to include extra details only for users that have a ``ROLE_SALES_ADMIN`` ro

// ...
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
+ use Symfony\Bundle\SecurityBundle\Security\Security;
+ use Symfony\Bundle\SecurityBundle\Security;

class SalesReportManager
{
Expand Down
4 changes: 2 additions & 2 deletions security/impersonating_user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ the impersonator user::
// src/Service/SomeService.php
namespace App\Service;

use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
// ...

Expand Down Expand Up @@ -367,7 +367,7 @@ logic you want::
// src/Security/Voter/SwitchToCustomerVoter.php
namespace App\Security\Voter;

use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\User\UserInterface;
Expand Down
2 changes: 1 addition & 1 deletion security/voters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ with ``ROLE_SUPER_ADMIN``::
// src/Security/PostVoter.php

// ...
use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Bundle\SecurityBundle\Security;

class PostVoter extends Voter
{
Expand Down
2 changes: 1 addition & 1 deletion session/proxy_examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ can intercept the session before it is written::
namespace App\Session;

use App\Entity\User;
use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;

class ReadOnlySessionProxy extends SessionHandlerProxy
Expand Down