Merge branch '2.7' into 2.8
* 2.7: Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)" [DependencyInjection] inline conditional statements.
This commit is contained in:
commit
15106bf918
@ -216,6 +216,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();
|
||||
@ -280,7 +290,7 @@ class SecurityExtension extends Extension
|
||||
$contextKey = $firewall['context'];
|
||||
}
|
||||
|
||||
$listeners[] = new Reference($this->createContextListener($container, $contextKey, $defaultProvider));
|
||||
$listeners[] = new Reference($this->createContextListener($container, $contextKey));
|
||||
}
|
||||
|
||||
// Logout listener
|
||||
@ -365,7 +375,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];
|
||||
@ -373,7 +383,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;
|
||||
|
@ -1029,11 +1029,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";
|
||||
@ -1402,9 +1398,9 @@ EOF;
|
||||
$service = $this->dumpValue($value->getFactoryService(false));
|
||||
|
||||
return sprintf('%s->%s(%s)', 0 === strpos($service, '$') ? sprintf('$this->get(%s)', $service) : $this->getServiceCall($value->getFactoryService(false)), $value->getFactoryMethod(false), implode(', ', $arguments));
|
||||
} else {
|
||||
throw new RuntimeException('Cannot dump definitions which have factory method without factory service or factory class.');
|
||||
}
|
||||
|
||||
throw new RuntimeException('Cannot dump definitions which have factory method without factory service or factory class.');
|
||||
}
|
||||
|
||||
$class = $value->getClass();
|
||||
@ -1442,9 +1438,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1513,13 +1509,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