@@ -9,6 +9,17 @@ cannot only be based on the person (``Token``) who is requesting access, but
9
9
also involve a domain object that access is being requested for. This is where
10
10
the ACL system comes in.
11
11
12
+ .. sidebar :: Alternatives to ACLS
13
+
14
+ Using ACL's isn't trivial, and for simpler use cases, it may be overkill.
15
+ If your permission logic could be described by just writing some code (e.g.
16
+ to check if a Blog is owned by the current User), then consider using
17
+ :doc: `voters </cookbook/security/voters >`. A voter is passed the object
18
+ being voted on, which you can use to make complex decisions and effectively
19
+ implement your own ACL. Enforcing authorization (e.g. the ``isGranted ``
20
+ part) will look similar to what you see in this entry, but your voter
21
+ class will handle the logic behind the scenes, instead of the ACL system.
22
+
12
23
Imagine you are designing a blog system where your users can comment on your
13
24
posts. Now, you want a user to be able to edit his own comments, but not those
14
25
of other users; besides, you yourself want to be able to edit all comments. In
@@ -215,16 +226,4 @@ added above:
215
226
216
227
The user is now allowed to view, edit, delete, and un-delete objects.
217
228
218
- Looking for Alternatives
219
- ------------------------
220
-
221
- For more simple use cases this seems to be an overhead for many developers.
222
- As a downside there is that in case you change the permissions in any way,
223
- you need to change all the existing granted permissions as well. As well
224
- when you want to change a specific part of the ACL you need to understand
225
- the structure and process of this complex voter. So you should consider if
226
- a classical and simple conditional permission check would fit for you.
227
- Some do it with the existing voter ":doc: `/cookbook/security/voters `"
228
- structure as well, or a custom build solutions.
229
-
230
229
.. _`MongoDBAclBundle` : https://github.com/IamPersistent/MongoDBAclBundle
0 commit comments