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

[Security] Move the Security helper to SecurityBundle#16848

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 1 commit intosymfony:6.2fromjaviereguiluz:fix_16846
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes fromall 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
2 changes: 1 addition & 1 deletioncontroller/argument_value_resolver.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,10 +220,10 @@ retrieved from the token storage::
namespace App\ArgumentResolver;

use App\Entity\User;
use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
use Symfony\Component\Security\Core\Security;

class UserValueResolver implements ArgumentValueResolverInterface
{
Expand Down
4 changes: 2 additions & 2 deletionsform/dynamic_form_modification.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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 injecting the ``Security``
service into the form type so you can get the current user object::

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

class FriendMessageFormType extends AbstractType
Expand All@@ -260,9 +260,9 @@ 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\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Security\Core\Security;
// ...

class FriendMessageFormType extends AbstractType
Expand Down
12 changes: 9 additions & 3 deletionssecurity.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1775,12 +1775,12 @@ Fetching the User from a Service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

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

use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security\Security;

class ExampleService
{
Expand All@@ -1802,6 +1802,12 @@ 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
was introduced in Symfony 6.2. In previous Symfony versions this class was
defined in ``Symfony\Component\Security\Core\Security``.

Fetch the User in a Template
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand DownExpand Up@@ -2235,7 +2241,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\Component\Security\Core\Security;
+ use Symfony\Bundle\SecurityBundle\Security\Security;

class SalesReportManager
{
Expand Down
4 changes: 2 additions & 2 deletionssecurity/impersonating_user.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -160,8 +160,8 @@ the impersonator user::
// src/Service/SomeService.php
namespace App\Service;

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

class SomeService
Expand DownExpand Up@@ -306,9 +306,9 @@ logic you want::
// src/Security/Voter/SwitchToCustomerVoter.php
namespace App\Security\Voter;

use Symfony\Bundle\SecurityBundle\Security\Security;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Core\User\UserInterface;

class SwitchToCustomerVoter extends Voter
Expand Down
2 changes: 1 addition & 1 deletionsecurity/voters.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -229,7 +229,7 @@ with ``ROLE_SUPER_ADMIN``::
// src/Security/PostVoter.php

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

class PostVoter extends Voter
{
Expand Down
2 changes: 1 addition & 1 deletionsession/proxy_examples.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,8 +110,8 @@ can intercept the session before it is written::
namespace App\Session;

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

class ReadOnlySessionProxy extends SessionHandlerProxy
{
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp