Skip to content

Custom AccessDecisionManager not getting list of voters as first argument in __construct #42095

Closed
@sarbanha

Description

@sarbanha

With reference to the issue #41123

I encountered this issue with different symptoms!

Although I knew the service is automatically registered but I did this in service.yml:

    App\Security\SpecialAccessDecisionManager:
        class: App\Security\SpecialAccessDecisionManager  
        autowire: false
        autoconfigure: false
        public: false

then I added decision manager to security.yml:

security:
    access_decision_manager:
        service: App\Security\SpecialAccessDecisionManager

As you can see below, arguments haven't been passed to the decision manager:

[root@dev7 rouzonline.test]# bin/console debug:container debug.security.access.decision_manager.inner --show-arguments                            

 // This service is a private alias for the service                                                                     
 // App\Security\SpecialAccessDecisionManager                                                                           

Information for Service "App\Security\SpecialAccessDecisionManager"
===================================================================

 Description of SpecialAccessDecisionManager

 ---------------- ------------------------------------------- 
  Option           Value                                      
 ---------------- ------------------------------------------- 
  Service ID       App\Security\SpecialAccessDecisionManager  
  Class            App\Security\SpecialAccessDecisionManager  
  Tags             -                                          
  Public           no                                         
  Synthetic        no                                         
  Lazy             no                                         
  Shared           yes                                        
  Abstract         no                                         
  Autowired        no                                         
  Autoconfigured   no                                         
 ---------------- ------------------------------------------- 


 ! [NOTE] The "debug.security.access.decision_manager.inner" service or alias has been removed or inlined when the      
 !        container was compiled.                                                                                       

[root@dev7 rouzonline.test]#

When I use default AccessDecisionManager voters are passed. I need to implement special authorization so I need to create my own decision manager. By the way, my decision manager implements AccessDecisionManagerInterface

I also checked \SecurityBundle\DependencyInjection\Compiler\AddSecurityVotersPass->process() , it is not being called when my decision manager is set.

Any idea?

UPDATE
For testing, I temporarily renamed default AccessDecisionManager.php and placed my decision manager, it surprisingly worked. But it is not the solution. Still looking for the correct solution.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions