Skip to content

Commit c7369d5

Browse files
committed
[Security][SecurityBundle] Move the Security helper to SecurityBundle
1 parent 58c1978 commit c7369d5

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

controller/argument_value_resolver.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ retrieved from the token storage::
220220
namespace App\ArgumentResolver;
221221

222222
use App\Entity\User;
223+
use Symfony\Bundle\SecurityBundle\Security\Security;
223224
use Symfony\Component\HttpFoundation\Request;
224225
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
225226
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
226-
use Symfony\Component\Security\Core\Security;
227227

228228
class UserValueResolver implements ArgumentValueResolverInterface
229229
{

form/dynamic_form_modification.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ The problem is now to get the current user and create a choice field that
233233
contains only this user's friends. This can be done injecting the ``Security``
234234
service into the form type so you can get the current user object::
235235

236-
use Symfony\Component\Security\Core\Security;
236+
use Symfony\Bundle\SecurityBundle\Security\Security;
237237
// ...
238238

239239
class FriendMessageFormType extends AbstractType
@@ -260,9 +260,9 @@ security helper to fill in the listener logic::
260260
use App\Entity\User;
261261
use Doctrine\ORM\EntityRepository;
262262
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
263+
use Symfony\Bundle\SecurityBundle\Security\Security;
263264
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
264265
use Symfony\Component\Form\Extension\Core\Type\TextType;
265-
use Symfony\Component\Security\Core\Security;
266266
// ...
267267

268268
class FriendMessageFormType extends AbstractType

security.rst

+9-3
Original file line numberDiff line numberDiff line change
@@ -1775,12 +1775,12 @@ Fetching the User from a Service
17751775
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17761776

17771777
If you need to get the logged in user from a service, use the
1778-
:class:`Symfony\\Component\\Security\\Core\\Security` service::
1778+
:class:`Symfony\\Bundle\\SecurityBundle\\Security\\Security` service::
17791779

17801780
// src/Service/ExampleService.php
17811781
// ...
17821782

1783-
use Symfony\Component\Security\Core\Security;
1783+
use Symfony\Bundle\SecurityBundle\Security\Security;
17841784

17851785
class ExampleService
17861786
{
@@ -1802,6 +1802,12 @@ If you need to get the logged in user from a service, use the
18021802
}
18031803
}
18041804

1805+
.. versionadded:: 6.2
1806+
1807+
The :class:`Symfony\\Bundle\\SecurityBundle\\Security\\Security` class
1808+
was introduced in Symfony 6.2. In previous Symfony versions this class was
1809+
defined in ``Symfony\Component\Security\Core\Security``.
1810+
18051811
Fetch the User in a Template
18061812
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18071813

@@ -2235,7 +2241,7 @@ want to include extra details only for users that have a ``ROLE_SALES_ADMIN`` ro
22352241
22362242
// ...
22372243
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
2238-
+ use Symfony\Component\Security\Core\Security;
2244+
+ use Symfony\Bundle\SecurityBundle\Security\Security;
22392245
22402246
class SalesReportManager
22412247
{

security/impersonating_user.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ the impersonator user::
160160
// src/Service/SomeService.php
161161
namespace App\Service;
162162

163+
use Symfony\Bundle\SecurityBundle\Security\Security;
163164
use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
164-
use Symfony\Component\Security\Core\Security;
165165
// ...
166166

167167
class SomeService
@@ -306,9 +306,9 @@ logic you want::
306306
// src/Security/Voter/SwitchToCustomerVoter.php
307307
namespace App\Security\Voter;
308308

309+
use Symfony\Bundle\SecurityBundle\Security\Security;
309310
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
310311
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
311-
use Symfony\Component\Security\Core\Security;
312312
use Symfony\Component\Security\Core\User\UserInterface;
313313

314314
class SwitchToCustomerVoter extends Voter

security/voters.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ with ``ROLE_SUPER_ADMIN``::
229229
// src/Security/PostVoter.php
230230

231231
// ...
232-
use Symfony\Component\Security\Core\Security;
232+
use Symfony\Bundle\SecurityBundle\Security\Security;
233233

234234
class PostVoter extends Voter
235235
{

session/proxy_examples.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ can intercept the session before it is written::
110110
namespace App\Session;
111111

112112
use App\Entity\User;
113+
use Symfony\Bundle\SecurityBundle\Security\Security;
113114
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
114-
use Symfony\Component\Security\Core\Security;
115115

116116
class ReadOnlySessionProxy extends SessionHandlerProxy
117117
{

0 commit comments

Comments
 (0)