Skip to content

Commit d4afd3a

Browse files
committed
[#5453] Minor tweaks - mostly thanks to Javier
1 parent 589828d commit d4afd3a

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

book/security.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ other users. Also, as the admin user, you yourself want to be able to edit
929929

930930
To accomplish this you have 2 options:
931931

932-
* :doc:`Voters </cookbook/security/voters>` allow you to use business logic
932+
* :doc:`Voters </cookbook/security/voters>` allow you to write own business logic
933933
(e.g. the user can edit this post because they were the creator) to determine
934934
access. You'll probably want this option - it's flexible enough to solve the
935935
above situation.

cookbook/security/voters.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ All voters are called each time you use the ``isGranted()`` method on Symfony's
2424
security context (i.e. the ``security.context`` service). Each one decides
2525
if the current user should have access to some resource.
2626

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.
2930

3031
For more information take a look at
3132
: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:
4950
a role like ``ROLE_USER``, an ACL ``EDIT``, etc.).
5051

5152
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
5354
access is being checked.
5455

5556
The :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::vote`
@@ -87,10 +88,7 @@ edit a particular object. Here's an example implementation::
8788

8889
public function supportsAttribute($attribute)
8990
{
90-
return in_array($attribute, array(
91-
self::VIEW,
92-
self::EDIT,
93-
));
91+
return in_array($attribute, array(self::VIEW, self::EDIT));
9492
}
9593

9694
public function supportsClass($class)
@@ -229,7 +227,7 @@ from the security context is called.
229227
230228
// keep in mind, this will call all registered security voters
231229
if (false === $this->get('security.context')->isGranted('view', $post)) {
232-
throw new AccessDeniedException('Unauthorised access!');
230+
throw new AccessDeniedException('Unauthorized access!');
233231
}
234232
235233
return new Response('<h1>'.$post->getName().'</h1>');

0 commit comments

Comments
 (0)