Merge branch '2.8' into 3.2
* 2.8: Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)" [DependencyInjection] inline conditional statements.
This commit is contained in:
commit
fcde9e689d
@ -223,6 +223,16 @@ class SecurityExtension extends Extension
|
||||
$firewalls = $config['firewalls'];
|
||||
$providerIds = $this->createUserProviders($config, $container);
|
||||
|
||||
// make the ContextListener aware of the configured user providers
|
||||
$definition = $container->getDefinition('security.context_listener');
|
||||
$arguments = $definition->getArguments();
|
||||
$userProviders = array();
|
||||
foreach ($providerIds as $userProviderId) {
|
||||
$userProviders[] = new Reference($userProviderId);
|
||||
}
|
||||
$arguments[1] = $userProviders;
|
||||
$definition->setArguments($arguments);
|
||||
|
||||
// load firewall map
|
||||
$mapDef = $container->getDefinition('security.firewall.map');
|
||||
$map = $authenticationProviders = array();
|
||||
@ -304,7 +314,7 @@ class SecurityExtension extends Extension
|
||||
$contextKey = $firewall['context'];
|
||||
}
|
||||
|
||||
$listeners[] = new Reference($this->createContextListener($container, $contextKey, $defaultProvider));
|
||||
$listeners[] = new Reference($this->createContextListener($container, $contextKey));
|
||||
}
|
||||
|
||||
$config->replaceArgument(6, $contextKey);
|
||||
@ -413,7 +423,7 @@ class SecurityExtension extends Extension
|
||||
return array($matcher, $listeners, $exceptionListener);
|
||||
}
|
||||
|
||||
private function createContextListener($container, $contextKey, $providerId)
|
||||
private function createContextListener($container, $contextKey)
|
||||
{
|
||||
if (isset($this->contextListeners[$contextKey])) {
|
||||
return $this->contextListeners[$contextKey];
|
||||
@ -421,7 +431,6 @@ class SecurityExtension extends Extension
|
||||
|
||||
$listenerId = 'security.context_listener.'.count($this->contextListeners);
|
||||
$listener = $container->setDefinition($listenerId, new DefinitionDecorator('security.context_listener'));
|
||||
$listener->replaceArgument(1, array(new Reference($providerId)));
|
||||
$listener->replaceArgument(2, $contextKey);
|
||||
|
||||
return $this->contextListeners[$contextKey] = $listenerId;
|
||||
|
@ -963,11 +963,7 @@ EOF;
|
||||
private function addAliases()
|
||||
{
|
||||
if (!$aliases = $this->container->getAliases()) {
|
||||
if ($this->container->isFrozen()) {
|
||||
return "\n \$this->aliases = array();\n";
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
return $this->container->isFrozen() ? "\n \$this->aliases = array();\n" : '';
|
||||
}
|
||||
|
||||
$code = " \$this->aliases = array(\n";
|
||||
@ -1426,9 +1422,9 @@ EOF;
|
||||
}
|
||||
} elseif (is_object($value) || is_resource($value)) {
|
||||
throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.');
|
||||
} else {
|
||||
return $this->export($value);
|
||||
}
|
||||
|
||||
return $this->export($value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1489,13 +1485,13 @@ EOF;
|
||||
}
|
||||
if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) {
|
||||
return sprintf('$this->get(\'%s\', ContainerInterface::NULL_ON_INVALID_REFERENCE)', $id);
|
||||
} else {
|
||||
if ($this->container->hasAlias($id)) {
|
||||
$id = (string) $this->container->getAlias($id);
|
||||
}
|
||||
|
||||
return sprintf('$this->get(\'%s\')', $id);
|
||||
}
|
||||
|
||||
if ($this->container->hasAlias($id)) {
|
||||
$id = (string) $this->container->getAlias($id);
|
||||
}
|
||||
|
||||
return sprintf('$this->get(\'%s\')', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user