Symfony Voter supports method receiving ROLE and Request instead attribute and entity -


the voter seems work on whole app... except on controller:

 $entity = $em->getreference('appbundle:offer',$id);  $this->denyaccessunlessgranted('overview', $entity); 

where voter method receiving wrong arguments ....

supports($attribute, $subject)

dump($attribute)-> role_user // instead 'overview' dump($subject)-> request object // instead $entity 

the voter config is:

app_voter:     class:      appbundle\security\authorization\appvoter     public:     true     strategy: affirmative     arguments: ['@role_hierarchy', '@security.token_storage']     tags:         - { name: security.voter } 

the problem disappears if instead 'overview' write 'view' on controller code.

i forgot add 'overview' method 'supports' :

  protected function supports($attribute, $subject) {         // if attribute isn't 1 support, return false         if (!in_array($attribute, array(self::overview, self::view, self::edit))) {             return false;         }          // bypass if entity not supported         if (!$this->issupportedclass($subject)) {             return true;         }         return true;     } 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -