{"action":"opened","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/15024","labels_url":"https://api.github.com/repos/symfony/symfony/issues/15024/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/15024/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/15024/events","html_url":"https://github.com/symfony/symfony/issues/15024","id":89297795,"number":15024,"title":"[VOTER] Voter unanimous decision-strategy looping though the passed attributes (Question)","user":{"login":"samgavinio","id":8102514,"avatar_url":"https://avatars.githubusercontent.com/u/8102514?v=3","gravatar_id":"","url":"https://api.github.com/users/samgavinio","html_url":"https://github.com/samgavinio","followers_url":"https://api.github.com/users/samgavinio/followers","following_url":"https://api.github.com/users/samgavinio/following{/other_user}","gists_url":"https://api.github.com/users/samgavinio/gists{/gist_id}","starred_url":"https://api.github.com/users/samgavinio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samgavinio/subscriptions","organizations_url":"https://api.github.com/users/samgavinio/orgs","repos_url":"https://api.github.com/users/samgavinio/repos","events_url":"https://api.github.com/users/samgavinio/events{/privacy}","received_events_url":"https://api.github.com/users/samgavinio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-18T13:42:42Z","updated_at":"2015-06-18T13:42:42Z","closed_at":null,"body":"[QUESTION] I implemented a custom Symfony2 Voter and would pass an array of attributes to the first parameter of the `denyAccessUnlessGranted` like so in my controller:\r\n```\r\n$attr = [\r\n    'module' => 'userModule'\r\n    'action' => 'edit'\r\n];\r\n$this->denyAccessUnlessGranted($attr, $this, 'Not authorize to edit user');\r\n```\r\n\r\nThis works alright if the decision manager approach is set to `affirmative`. However when I shifted to the `unanimous` approach all of sudden things didn't work. I looked through the Symfony source code and found that the reason is because the method for determining the result of a vote for the unanimous approach loops through the attributes before calling all the registered voters (instead of simply passing them to the voters as is the case for the affirmative and consensus approaches).\r\n\r\nSnippets of the Symfony/Component/Security/Core/Authorization/AccessDecisionManager are included below:\r\n```\r\nprivate function decideAffirmative(TokenInterface $token, array $attributes, $object = null)\r\n{\r\n    $deny = 0;\r\n    foreach ($this->voters as $voter) {\r\n        $result = $voter->vote($token, $object, $attributes);\r\n        ...\r\n     }\r\n}\r\n\r\nprivate function decideConsensus(TokenInterface $token, array $attributes, $object = null)\r\n{\r\n    foreach ($this->voters as $voter) {\r\n        $result = $voter->vote($token, $object, $attributes);\r\n        ...\r\n    }\r\n}\r\n\r\n\r\nprivate function decideUnanimous(TokenInterface $token, array $attributes, $object = null)\r\n{\r\n    $grant = 0;\r\n    // ***** THIS IS THE ISSUE: WHY LOOP THROUGH THE ATTRIBUTES ****\r\n    foreach ($attributes as $attribute) {\r\n        foreach ($this->voters as $voter) {\r\n            $result = $voter->vote($token, $object, array($attribute));\r\n            ...\r\n        }\r\n    }\r\n }\r\n```\r\n\r\nThe one for the unanimous decision making is the third one. What's the reasoning behind having to loop through the attributes? Does this mean I have to recode my custom voter depending on what decision making strategy I use? Or maybe I'm simply using the attribute argument in a way that it's not designed to be used."}}