Open akomm opened 8 years ago
:+1: What about:
dunglas_action:
must_be_public:
- Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
and make all the others private (or maybe also add an option for that)?
IMO every service should be able to be private but it was refused in the core.
Why not using a user-land compiler pass for that? You can do a simple check on the namespace.
@dunglas that's indeed already possible but it complexify the installation of the bundle. Including it here would also permit to follow the core autowiring behavior (private by default).
:+1: private by default and public by option sounds good.
👎 for private services by default, I would rather just follow the Symfony convention here. As services are not private by default (although there is an issue to change that, https://github.com/symfony/symfony/issues/20048), I don't think it should be done here.
Instead of just having tags
, why not having services
instead to which we can append things to the service definition, i.e. tags and public properties?
dunglas_action:
services:
'Symfony\Component\Security\Core\Authorization\Voter\VoterInterface':
tags: [ name: 'mytag' ]
public: false
EDIT: actually isn't it already doable by overriding the service definition?
services:
'Symfony\Component\Security\Core\Authorization\Voter\VoterInterface':
tags: [ name: 'mytag' ]
public: false
I have created a CompilerPass for another "service option" that resolves a "problem" with the "autotag" feature: if you need to set a priority for a service, then you can't use autotag.
I have implemented an interface PrioritizedInterface
with a method getPriority
, and the CompilerPass searches for services with this interface and set the priority calling this method.
That way I can use autotag and priority.
If you think this is of interest for this bundle, I can make a PR
I want to also add
public: false
property to all Voters. I have the following entry:I would not like to define all the Voter services, just because I want them all to be private. Do you think a config key for options (excluding autowire) would be a good solution for this?