From ce4f418093938f9325c9f92cd6830959abf93fd0 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Sun, 21 Apr 2013 18:27:20 +0300 Subject: [PATCH 1/3] Added tip regarding VoterInterface restrictions Added tip about supportsAttribute and supportsClass fixes #2493 --- cookbook/security/voters.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index 9960a032183..282ef69cf4a 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -100,6 +100,14 @@ and compare the IP address against a set of blacklisted IP addresses: That's it! The voter is done. The next step is to inject the voter into the security layer. This can be done easily through the service container. +.. tip:: + + The methods supportsAttribute() and supportsClass() are not being called + internally by the framework. Once you have registered your voter the vote() + method will always be called, not depending on your restrictions. Therefore + you need to call those methods in your implementation of the vote() method. + + Declaring the Voter as a Service -------------------------------- From 3257f43a9a369051da37ea51634d5b44cea6eba3 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Sun, 21 Apr 2013 20:18:32 +0300 Subject: [PATCH 2/3] Added API Links --- cookbook/security/voters.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index 282ef69cf4a..d019facd506 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -102,11 +102,11 @@ the security layer. This can be done easily through the service container. .. tip:: - The methods supportsAttribute() and supportsClass() are not being called - internally by the framework. Once you have registered your voter the vote() - method will always be called, not depending on your restrictions. Therefore - you need to call those methods in your implementation of the vote() method. - + Your implementation of the methods :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::supportsAttribute` and `Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::supportsClass` are + not being called internally by the framework. Once you have registered your + voter the ``vote()`` method will always be called, not depending on your + restrictions. Therefore you need to call those methods in your implementation + of the ``vote()`` method. Declaring the Voter as a Service -------------------------------- From b6e11ac1d0881ab93b48bb7b4de5989e4a027b77 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Sun, 21 Apr 2013 20:22:44 +0300 Subject: [PATCH 3/3] Line Format --- cookbook/security/voters.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index d019facd506..c6d18724de2 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -102,8 +102,10 @@ the security layer. This can be done easily through the service container. .. tip:: - Your implementation of the methods :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::supportsAttribute` and `Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::supportsClass` are - not being called internally by the framework. Once you have registered your + Your implementation of the methods + :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::supportsAttribute` + and :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::supportsClass` + are not being called internally by the framework. Once you have registered your voter the ``vote()`` method will always be called, not depending on your restrictions. Therefore you need to call those methods in your implementation of the ``vote()`` method.