Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented FirewallPluginInterface #31

Merged
merged 2 commits into from
May 22, 2017
Merged

Implemented FirewallPluginInterface #31

merged 2 commits into from
May 22, 2017

Conversation

aschempp
Copy link
Member

@aschempp aschempp commented May 8, 2017

see #24

This solves the issue that security firewall configuration cannot be extended (cannotBeOverwritten is set on the TreeBuilder). I wonder if it would make sense to implement this as a general solution as we don't know if there are other such nodes?

@aschempp aschempp added this to the 4.4.0 milestone May 8, 2017
@aschempp aschempp requested review from Toflar and leofeyer May 8, 2017 16:21
Copy link
Member

@Toflar Toflar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests fail. Other than that looks good, thank you!

I wonder if it would make sense to implement this as a general solution as we don't know if there are other such nodes?

To be honest, I can't think of one at the moment and we should not overcomplicate things right now as we're still in the early stages. I think the firewall is the 99% case and if there will be another one we might still build a general solution. Even if we build the general solution I still think it is a good thing to keep the FirewallPluginInterface because it is more specific in naming and pretty obvious why it's there. It might still map to a new, more general solution, in the future so we don't block anything here imho :)

{
return array_merge(
$config,
Yaml::parse(file_get_contents(__DIR__.'/../Resources/contao-manager/security_firewalls.yml'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you not passing the loader as argument so we can do

$loader->load('@ContaoManagerBundle/Resources/contao-manager/security_firewalls.yml');

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be an array so you can order it. That's the whole point about this plugin :)

@aschempp
Copy link
Member Author

I have rewritten the implementation to use a more generic approach. The new ExtensionPluginInterface allows to process all extension configurations before they are used (basically, before they are processed by the extension).

This has several advantages:

  1. It's not specific to firewalls
  2. In regular cases, the interface is not needed at all
  3. It allows a plugin to modify all extension configuration from all bundles (even prepend), plugins and the application configuration itself.

The tests are currently failing because of #29

$container = new PluginContainerBuilder($this->getPluginLoader(), []);
$container->getParameterBag()->add($this->getKernelParameters());

if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use Configuration::class and RuntimeInstantiator::class here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That code is a direct copy from Symfony so I'd rather not change it…?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. :)

@aschempp aschempp merged commit e4fc60b into develop May 22, 2017
@aschempp aschempp deleted the firewall-plugin branch May 22, 2017 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants