@@ -24,8 +24,9 @@ All voters are called each time you use the ``isGranted()`` method on Symfony's
24
24
security context (i.e. the ``security.context `` service). Each one decides
25
25
if the current user should have access to some resource.
26
26
27
- Ultimately, Symfony uses one of three different approaches on what to do
28
- with the feedback from all voters: affirmative, consensus and unanimous.
27
+ Ultimately, Symfony takes the responses from all voters and makes the final
28
+ decission (to allow or deny access to the resource) according to the strategy defined
29
+ in the application, which can be: affirmative, consensus or unanimous.
29
30
30
31
For more information take a look at
31
32
:ref: `the section about access decision managers <components-security-access-decision-manager >`.
@@ -49,7 +50,7 @@ method is used to check if the voter supports the given user attribute (i.e:
49
50
a role like ``ROLE_USER ``, an ACL ``EDIT ``, etc.).
50
51
51
52
The :method: `Symfony\\ Component\\ Security\\ Core\\ Authorization\\ Voter\\ VoterInterface::supportsClass `
52
- method is used to check if the voter supports the class of the object whose
53
+ method checks whether the voter supports the class of the object whose
53
54
access is being checked.
54
55
55
56
The :method: `Symfony\\ Component\\ Security\\ Core\\ Authorization\\ Voter\\ VoterInterface::vote `
@@ -87,10 +88,7 @@ edit a particular object. Here's an example implementation::
87
88
88
89
public function supportsAttribute($attribute)
89
90
{
90
- return in_array($attribute, array(
91
- self::VIEW,
92
- self::EDIT,
93
- ));
91
+ return in_array($attribute, array(self::VIEW, self::EDIT));
94
92
}
95
93
96
94
public function supportsClass($class)
@@ -229,7 +227,7 @@ from the security context is called.
229
227
230
228
// keep in mind, this will call all registered security voters
231
229
if (false === $this->get('security.context')->isGranted('view', $post)) {
232
- throw new AccessDeniedException('Unauthorised access!');
230
+ throw new AccessDeniedException('Unauthorized access!');
233
231
}
234
232
235
233
return new Response('<h1 >'.$post->getName().'</h1 >');
0 commit comments