Actualización

This commit is contained in:
Xes
2025-04-10 12:24:57 +02:00
parent 8969cc929d
commit 45420b6f0d
39760 changed files with 4303286 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\UserBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Flex\Recipe;
/**
* Checks to see if the mailer service exists.
*
* @author Ryan Weaver <ryan@knpuniversity.com>
*/
class CheckForMailerPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
// if the mailer isn't needed, then no error needed
if (!$container->has('fos_user.mailer')) {
return;
}
// the mailer exists, so all is good
if ($container->has('mailer')) {
return;
}
if ($container->findDefinition('fos_user.mailer')->hasTag('fos_user.requires_swift')) {
$message = 'A feature you activated in FOSUserBundle requires the "mailer" service to be available.';
if (class_exists(Recipe::class)) {
$message .= ' Run "composer require swiftmailer-bundle" to install SwiftMailer or configure a different mailer in "config/packages/fos_user.yaml".';
}
throw new \LogicException($message);
}
}
}

View File

@@ -0,0 +1,40 @@
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\UserBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Flex\Recipe;
/**
* Checks to see if the session service exists.
*
* @author Ryan Weaver <ryan@knpuniversity.com>
*/
class CheckForSessionPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if ($container->has('fos_user.session') && !$container->has('session')) {
$message = 'FOSUserBundle requires the "session" service to be available.';
if (class_exists(Recipe::class)) {
$message .= ' Uncomment the "session" section in "config/packages/framework.yaml" to activate it.';
}
throw new \LogicException($message);
}
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\UserBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Inject RememberMeServices into LoginManager.
*
* @author Vasily Khayrulin <sirianru@gmail.com>
*/
class InjectRememberMeServicesPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
$firewallName = $container->getParameter('fos_user.firewall_name');
$loginManager = $container->getDefinition('fos_user.security.login_manager');
if ($container->hasDefinition('security.authentication.rememberme.services.persistent.'.$firewallName)) {
$loginManager->replaceArgument(4, new Reference('security.authentication.rememberme.services.persistent.'.$firewallName));
} elseif ($container->hasDefinition('security.authentication.rememberme.services.simplehash.'.$firewallName)) {
$loginManager->replaceArgument(4, new Reference('security.authentication.rememberme.services.simplehash.'.$firewallName));
}
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\UserBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Injects firewall's UserChecker into LoginManager.
*
* @author Gocha Ossinkine <ossinkine@ya.ru>
*/
class InjectUserCheckerPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
$firewallName = $container->getParameter('fos_user.firewall_name');
$loginManager = $container->findDefinition('fos_user.security.login_manager');
if ($container->has('security.user_checker.'.$firewallName)) {
$loginManager->replaceArgument(1, new Reference('security.user_checker.'.$firewallName));
}
}
}

View File

@@ -0,0 +1,44 @@
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\UserBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Registers the additional validators according to the storage.
*
* @author Christophe Coevoet <stof@notk.org>
*/
class ValidationPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasParameter('fos_user.storage')) {
return;
}
$storage = $container->getParameter('fos_user.storage');
if ('custom' === $storage) {
return;
}
$validationFile = __DIR__.'/../../Resources/config/storage-validation/'.$storage.'.xml';
$container->getDefinition('validator.builder')
->addMethodCall('addXmlMapping', array($validationFile));
}
}