summaryrefslogtreecommitdiffstats
path: root/Core/Authorization
diff options
context:
space:
mode:
authorKonstantin.Myakshin <koc-dp@yandex.ru>2015-10-01 00:29:16 +0300
committerKonstantin.Myakshin <koc-dp@yandex.ru>2015-10-01 16:40:46 +0300
commit39e013d91988a626062431610bb2483612cf295a (patch)
treee5b31f2f10ab8afb2ae8dbfa65687bb12c320608 /Core/Authorization
parent3026c37b81a8839e6e6882f53a91a1a907cd8351 (diff)
downloadsymfony-security-39e013d91988a626062431610bb2483612cf295a.zip
symfony-security-39e013d91988a626062431610bb2483612cf295a.tar.gz
symfony-security-39e013d91988a626062431610bb2483612cf295a.tar.bz2
[3.0][Security] Remove deprecated features (follow up of #15899)
Diffstat (limited to 'Core/Authorization')
-rw-r--r--Core/Authorization/Voter/AbstractVoter.php8
-rw-r--r--Core/Authorization/Voter/AuthenticatedVoter.php20
-rw-r--r--Core/Authorization/Voter/ExpressionVoter.php18
-rw-r--r--Core/Authorization/Voter/RoleVoter.php18
4 files changed, 7 insertions, 57 deletions
diff --git a/Core/Authorization/Voter/AbstractVoter.php b/Core/Authorization/Voter/AbstractVoter.php
index ee73d29..71f570f 100644
--- a/Core/Authorization/Voter/AbstractVoter.php
+++ b/Core/Authorization/Voter/AbstractVoter.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Security\Core\Authorization\Voter;
-use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
/**
@@ -89,11 +88,8 @@ abstract class AbstractVoter implements VoterInterface
}
/**
- * 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:
- * a UserInterface object (fully authenticated user)
- * a string (anonymously authenticated user).
+ * Perform a single access check operation on a given attribute, object and token.
+ * It is safe to assume that $attribute and $object's class pass supports method call.
*
* @param string $attribute
* @param object $object
diff --git a/Core/Authorization/Voter/AuthenticatedVoter.php b/Core/Authorization/Voter/AuthenticatedVoter.php
index 5847e0d..762e9bc 100644
--- a/Core/Authorization/Voter/AuthenticatedVoter.php
+++ b/Core/Authorization/Voter/AuthenticatedVoter.php
@@ -44,27 +44,13 @@ class AuthenticatedVoter implements VoterInterface
/**
* {@inheritdoc}
*/
- public function supportsAttribute($attribute)
- {
- return null !== $attribute && (self::IS_AUTHENTICATED_FULLY === $attribute || self::IS_AUTHENTICATED_REMEMBERED === $attribute || self::IS_AUTHENTICATED_ANONYMOUSLY === $attribute);
- }
-
- /**
- * {@inheritdoc}
- */
- public function supportsClass($class)
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
public function vote(TokenInterface $token, $object, array $attributes)
{
$result = VoterInterface::ACCESS_ABSTAIN;
foreach ($attributes as $attribute) {
- if (!$this->supportsAttribute($attribute)) {
+ if (null === $attribute || (self::IS_AUTHENTICATED_FULLY !== $attribute
+ && self::IS_AUTHENTICATED_REMEMBERED !== $attribute
+ && self::IS_AUTHENTICATED_ANONYMOUSLY !== $attribute)) {
continue;
}
diff --git a/Core/Authorization/Voter/ExpressionVoter.php b/Core/Authorization/Voter/ExpressionVoter.php
index 98b8f50..0842856 100644
--- a/Core/Authorization/Voter/ExpressionVoter.php
+++ b/Core/Authorization/Voter/ExpressionVoter.php
@@ -52,28 +52,12 @@ class ExpressionVoter implements VoterInterface
/**
* {@inheritdoc}
*/
- public function supportsAttribute($attribute)
- {
- return $attribute instanceof Expression;
- }
-
- /**
- * {@inheritdoc}
- */
- public function supportsClass($class)
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
public function vote(TokenInterface $token, $object, array $attributes)
{
$result = VoterInterface::ACCESS_ABSTAIN;
$variables = null;
foreach ($attributes as $attribute) {
- if (!$this->supportsAttribute($attribute)) {
+ if (!$attribute instanceof Expression) {
continue;
}
diff --git a/Core/Authorization/Voter/RoleVoter.php b/Core/Authorization/Voter/RoleVoter.php
index 722675d..74e2363 100644
--- a/Core/Authorization/Voter/RoleVoter.php
+++ b/Core/Authorization/Voter/RoleVoter.php
@@ -35,29 +35,13 @@ class RoleVoter implements VoterInterface
/**
* {@inheritdoc}
*/
- public function supportsAttribute($attribute)
- {
- return 0 === strpos($attribute, $this->prefix);
- }
-
- /**
- * {@inheritdoc}
- */
- public function supportsClass($class)
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
public function vote(TokenInterface $token, $object, array $attributes)
{
$result = VoterInterface::ACCESS_ABSTAIN;
$roles = $this->extractRoles($token);
foreach ($attributes as $attribute) {
- if (!$this->supportsAttribute($attribute)) {
+ if (0 !== strpos($attribute, $this->prefix)) {
continue;
}