diff options
-rw-r--r-- | Core/Authorization/AccessDecisionManager.php | 32 | ||||
-rw-r--r-- | Core/Authorization/AccessDecisionManagerInterface.php | 22 | ||||
-rw-r--r-- | Core/Authorization/Voter/AbstractVoter.php | 75 | ||||
-rw-r--r-- | Core/Authorization/Voter/VoterInterface.php | 22 |
4 files changed, 1 insertions, 150 deletions
diff --git a/Core/Authorization/AccessDecisionManager.php b/Core/Authorization/AccessDecisionManager.php index 7cefef1..e40d906 100644 --- a/Core/Authorization/AccessDecisionManager.php +++ b/Core/Authorization/AccessDecisionManager.php @@ -73,38 +73,6 @@ class AccessDecisionManager implements AccessDecisionManagerInterface } /** - * {@inheritdoc} - */ - public function supportsAttribute($attribute) - { - @trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED); - - foreach ($this->voters as $voter) { - if ($voter->supportsAttribute($attribute)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function supportsClass($class) - { - @trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED); - - foreach ($this->voters as $voter) { - if ($voter->supportsClass($class)) { - return true; - } - } - - return false; - } - - /** * Grants access if any voter returns an affirmative response. * * If all voters abstained from voting, the decision will be based on the diff --git a/Core/Authorization/AccessDecisionManagerInterface.php b/Core/Authorization/AccessDecisionManagerInterface.php index d18b5e3..723ef19 100644 --- a/Core/Authorization/AccessDecisionManagerInterface.php +++ b/Core/Authorization/AccessDecisionManagerInterface.php @@ -30,26 +30,4 @@ interface AccessDecisionManagerInterface * @return bool true if the access is granted, false otherwise */ public function decide(TokenInterface $token, array $attributes, $object = null); - - /** - * Checks if the access decision manager supports the given attribute. - * - * @param string $attribute An attribute - * - * @return bool true if this decision manager supports the attribute, false otherwise - * - * @deprecated since version 2.8, to be removed in 3.0. - */ - public function supportsAttribute($attribute); - - /** - * Checks if the access decision manager supports the given class. - * - * @param string $class A class name - * - * @return true if this decision manager can process the class - * - * @deprecated since version 2.8, to be removed in 3.0. - */ - public function supportsClass($class); } diff --git a/Core/Authorization/Voter/AbstractVoter.php b/Core/Authorization/Voter/AbstractVoter.php index 12b54db..489c68d 100644 --- a/Core/Authorization/Voter/AbstractVoter.php +++ b/Core/Authorization/Voter/AbstractVoter.php @@ -22,32 +22,6 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; abstract class AbstractVoter implements VoterInterface { /** - * {@inheritdoc} - */ - public function supportsAttribute($attribute) - { - @trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED); - - return in_array($attribute, $this->getSupportedAttributes()); - } - - /** - * {@inheritdoc} - */ - public function supportsClass($class) - { - @trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED); - - foreach ($this->getSupportedClasses() as $supportedClass) { - if ($supportedClass === $class || is_subclass_of($class, $supportedClass)) { - return true; - } - } - - return false; - } - - /** * Iteratively check all given attributes by calling isGranted. * * This method terminates as soon as it is able to return ACCESS_GRANTED @@ -93,35 +67,12 @@ abstract class AbstractVoter implements VoterInterface * To determine if the passed class is instance of the supported class, the * isClassInstanceOf() method can be used. * - * This method will become abstract in 3.0. - * * @param string $attribute An attribute * @param string $class The fully qualified class name of the passed object * * @return bool True if the attribute and class is supported, false otherwise */ - protected function supports($attribute, $class) - { - @trigger_error('The getSupportedClasses and getSupportedAttributes methods are deprecated since version 2.8 and will be removed in version 3.0. Overwrite supports instead.', E_USER_DEPRECATED); - - $classIsSupported = false; - foreach ($this->getSupportedClasses() as $supportedClass) { - if ($this->isClassInstanceOf($class, $supportedClass)) { - $classIsSupported = true; - break; - } - } - - if (!$classIsSupported) { - return false; - } - - if (!in_array($attribute, $this->getSupportedAttributes())) { - return false; - } - - return true; - } + abstract protected function supports($attribute, $class); /** * A helper method to test if the actual class is instanceof or equal @@ -138,30 +89,6 @@ abstract class AbstractVoter implements VoterInterface } /** - * Return an array of supported classes. This will be called by supportsClass. - * - * @return array an array of supported classes, i.e. array('Acme\DemoBundle\Model\Product') - * - * @deprecated since version 2.8, to be removed in 3.0. Use supports() instead. - */ - protected function getSupportedClasses() - { - @trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED); - } - - /** - * Return an array of supported attributes. This will be called by supportsAttribute. - * - * @return array an array of supported attributes, i.e. array('CREATE', 'READ') - * - * @deprecated since version 2.8, to be removed in 3.0. Use supports() instead. - */ - protected function getSupportedAttributes() - { - @trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED); - } - - /** * Perform a single access check operation on a given attribute, object and (optionally) user * It is safe to assume that $attribute and $object's class pass supportsAttribute/supportsClass * $user can be one of the following: diff --git a/Core/Authorization/Voter/VoterInterface.php b/Core/Authorization/Voter/VoterInterface.php index 7e243f9..1697eaf 100644 --- a/Core/Authorization/Voter/VoterInterface.php +++ b/Core/Authorization/Voter/VoterInterface.php @@ -25,28 +25,6 @@ interface VoterInterface const ACCESS_DENIED = -1; /** - * Checks if the voter supports the given attribute. - * - * @param string $attribute An attribute - * - * @return bool true if this Voter supports the attribute, false otherwise - * - * @deprecated since version 2.8, to be removed in 3.0. - */ - public function supportsAttribute($attribute); - - /** - * Checks if the voter supports the given class. - * - * @param string $class A class name - * - * @return bool true if this Voter can process the class - * - * @deprecated since version 2.8, to be removed in 3.0. - */ - public function supportsClass($class); - - /** * Returns the vote for the given parameters. * * This method must return one of the following constants: |