@@ -5,10 +5,10 @@ How to implement your own Voter to blacklist IP Addresses
5
5
=========================================================
6
6
7
7
The Symfony2 Security component provides several layers to authorize users.
8
- One of the layers is called a ` voter ` . A voter is a dedicated class that checks
9
- if the user has the rights to be connected to the application. For instance,
10
- Symfony2 provides a layer that checks if the user is fully authorized or if
11
- it has some expected roles.
8
+ One of the layers is called a " voter" . A voter is a dedicated class that checks
9
+ if the user has the rights to connect to the application or access a specific
10
+ resource/URL. For instance, Symfony2 provides a layer that checks if the user
11
+ is fully authorized or if it has some expected roles.
12
12
13
13
It is sometimes useful to create a custom voter to handle a specific case not
14
14
handled by the framework. In this section, you'll learn how to create a voter
@@ -34,15 +34,15 @@ The ``supportsAttribute()`` method is used to check if the voter supports
34
34
the given user attribute (i.e: a role, an ACL, etc.).
35
35
36
36
The ``supportsClass() `` method is used to check if the voter supports the
37
- current user token class .
37
+ class of the object whose access is being checked (doesn't apply to this entry) .
38
38
39
39
The ``vote() `` method must implement the business logic that verifies whether
40
40
or not the user is granted access. This method must return one of the following
41
41
values:
42
42
43
- * ``VoterInterface::ACCESS_GRANTED ``: The user is allowed to access something
44
- * ``VoterInterface::ACCESS_ABSTAIN ``: The voter cannot decide if the user is granted or not
45
- * ``VoterInterface::ACCESS_DENIED ``: The user is not allowed to access something
43
+ * ``VoterInterface::ACCESS_GRANTED ``: The authorization will be granted by this voter;
44
+ * ``VoterInterface::ACCESS_ABSTAIN ``: The voter cannot decide if authorization should be granted;
45
+ * ``VoterInterface::ACCESS_DENIED ``: The authorization will be denied by this voter.
46
46
47
47
In this example, you'll check if the user's IP address matches against a list of
48
48
blacklisted addresses and "something" will be the application. If the user's IP is blacklisted, you'll return
0 commit comments