Skip to content

Commit 074c1dc

Browse files
committed
Fixed syntax issues, minor typos and markup issues
1 parent 36eabca commit 074c1dc

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

Diff for: cookbook/security/voters_data_permission.rst

+19-10
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ How Symfony Uses Voters
2525

2626
In order to use voters, you have to understand how Symfony works with them.
2727
All voters are called each time you use the ``isGranted()`` method on Symfony's
28-
authorization checker (i.e. the ``security.authorization_checker`` service). Each
28+
authorization checker (i.e. the ``security.authorization_checker`` service). Each
2929
one decides if the current user should have access to some resource.
3030

3131
Ultimately, Symfony uses one of three different approaches on what to do
@@ -116,18 +116,26 @@ the security layer.
116116
To recap, here's what's expected from the three abstract methods:
117117

118118
The :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\AbstractVoter::getSupportedClasses`
119-
method tells Symfony that your voter should be called whenever an object of one of the given classes
120-
is passed to `isGranted` For example, if you return ['\Acme\DemoBundle\Model\Product'],
121-
Symfony will call your voter when a `Product` object is passed to `isGranted`.
119+
method tells Symfony that your voter should be called whenever an object of one
120+
of the given classes is passed to ``isGranted()``. For example, if you return
121+
``array('AppBundle\Model\Product')``, Symfony will call your voter when a
122+
``Product`` object is passed to ``isGranted()``.
122123

123124
The :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\AbstractVoter::getSupportedAttributes`
124-
method tells Symfony that your voter should be called whenever one of these strings is passes as the
125-
first argument to `isGranted`. For example, if you return `array('CREATE', 'READ')`, then
126-
Symfony will call your voter when one of these is passed to `isGranted`.
125+
method tells Symfony that your voter should be called whenever one of these
126+
strings is passed as the first argument to ``isGranted()``. For example, if you
127+
return ``array('CREATE', 'READ')``, then Symfony will call your voter when one
128+
of these is passed to ``isGranted()``.
127129

128130
The :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\AbstractVoter::isGranted`
129131
method must implement the business logic that verifies whether or not a given
130-
user is allowed access to a given attribute on a given object. This method must return a boolean.
132+
user is allowed access to a given attribute (e.g. ``CREATE`` or ``READ``) on a
133+
given object. This method must return a boolean.
134+
135+
.. note::
136+
137+
Currently, to use the ``AbstractVoter`` base class, you must be creating a
138+
voter where an object is always passed to ``isGranted()``.
131139

132140
Declaring the Voter as a Service
133141
--------------------------------
@@ -206,7 +214,8 @@ from the authorization checker is called.
206214
}
207215
208216
.. versionadded:: 2.6
209-
The ``security.authorization_checker`` service was introduced in Symfony 2.6. Prior
210-
to Symfony 2.6, you had to use the ``isGranted()`` method of the ``security.context`` service.
217+
The ``security.authorization_checker`` service was introduced in Symfony 2.6.
218+
Prior to Symfony 2.6, you had to use the ``isGranted()`` method of the
219+
``security.context`` service.
211220

212221
It's that easy!

0 commit comments

Comments
 (0)