symfony2 more than one security voter for one Bundle

Asked

Viewed 25 times

0

I’m having trouble creating more than one voter for each class

the idea is to have a voter for each class to be able to realize access security to it, the first voter worked but the second ever access denied

I also noticed that in the services.yml only one can be added, it would be possible to create more than one voter for a Bundle?

example:

security.access.post_voter:
        class:      AppBundle\Security\Authorization\Voter\StateVoter
        public:     false
        tags:
            - { name: security.voter }

security.access.post_voter:
        class:      AppBundle\Security\Authorization\Voter\CityVoter
        public:     false
        tags:
            - { name: security.voter }

he won’t let you repeat security.acess.post_voter

1 answer

0


the problem was because it did not need to be called post_voter, I was wrong in the tutorial

security.access.state_voter:
        class:      AppBundle\Security\Authorization\Voter\StateVoter
        public:     false
        tags:
            - { name: security.voter }

security.access.city_voter:
        class:      AppBundle\Security\Authorization\Voter\CityVoter
        public:     false
        tags:
            - { name: security.voter }

all right now

Browser other questions tagged

You are not signed in. Login or sign up in order to post.