Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8d9d77f

Browse filesBrowse files
committed
[3.0][Security] Remove deprecated features (follow up of symfony#15899)
1 parent aa2e7e4 commit 8d9d77f
Copy full SHA for 8d9d77f

File tree

Expand file treeCollapse file tree

8 files changed

+16
-96
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+16
-96
lines changed

‎src/Symfony/Component/Security/Core/Authorization/Voter/AbstractVoter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/Voter/AbstractVoter.php
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Security\Core\Authorization\Voter;
1313

14-
use Symfony\Component\Security\Core\User\UserInterface;
1514
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1615

1716
/**
@@ -89,11 +88,7 @@ protected function isClassInstanceOf($actualClass, $expectedClass)
8988
}
9089

9190
/**
92-
* Perform a single access check operation on a given attribute, object and (optionally) user
93-
* It is safe to assume that $attribute and $object's class pass supportsAttribute/supportsClass
94-
* $user can be one of the following:
95-
* a UserInterface object (fully authenticated user)
96-
* a string (anonymously authenticated user).
91+
* Perform a single access check operation on a given attribute, object and token
9792
*
9893
* @param string $attribute
9994
* @param object $object

‎src/Symfony/Component/Security/Core/Authorization/Voter/AuthenticatedVoter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/Voter/AuthenticatedVoter.php
+5-16Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,6 @@ public function __construct(AuthenticationTrustResolverInterface $authentication
4141
$this->authenticationTrustResolver = $authenticationTrustResolver;
4242
}
4343

44-
/**
45-
* {@inheritdoc}
46-
*/
47-
public function supportsAttribute($attribute)
48-
{
49-
return null !== $attribute && (self::IS_AUTHENTICATED_FULLY === $attribute || self::IS_AUTHENTICATED_REMEMBERED === $attribute || self::IS_AUTHENTICATED_ANONYMOUSLY === $attribute);
50-
}
51-
52-
/**
53-
* {@inheritdoc}
54-
*/
55-
public function supportsClass($class)
56-
{
57-
return true;
58-
}
59-
6044
/**
6145
* {@inheritdoc}
6246
*/
@@ -91,4 +75,9 @@ public function vote(TokenInterface $token, $object, array $attributes)
9175

9276
return $result;
9377
}
78+
79+
private function supportsAttribute($attribute)
80+
{
81+
return null !== $attribute && (self::IS_AUTHENTICATED_FULLY === $attribute || self::IS_AUTHENTICATED_REMEMBERED === $attribute || self::IS_AUTHENTICATED_ANONYMOUSLY === $attribute);
82+
}
9483
}

‎src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php
+5-16Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,6 @@ public function addExpressionLanguageProvider(ExpressionFunctionProviderInterfac
4949
$this->expressionLanguage->registerProvider($provider);
5050
}
5151

52-
/**
53-
* {@inheritdoc}
54-
*/
55-
public function supportsAttribute($attribute)
56-
{
57-
return $attribute instanceof Expression;
58-
}
59-
60-
/**
61-
* {@inheritdoc}
62-
*/
63-
public function supportsClass($class)
64-
{
65-
return true;
66-
}
67-
6852
/**
6953
* {@inheritdoc}
7054
*/
@@ -115,4 +99,9 @@ private function getVariables(TokenInterface $token, $object)
11599

116100
return $variables;
117101
}
102+
103+
private function supportsAttribute($attribute)
104+
{
105+
return $attribute instanceof Expression;
106+
}
118107
}

‎src/Symfony/Component/Security/Core/Authorization/Voter/RoleVoter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/Voter/RoleVoter.php
+5-16Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,6 @@ public function __construct($prefix = 'ROLE_')
3232
$this->prefix = $prefix;
3333
}
3434

35-
/**
36-
* {@inheritdoc}
37-
*/
38-
public function supportsAttribute($attribute)
39-
{
40-
return 0 === strpos($attribute, $this->prefix);
41-
}
42-
43-
/**
44-
* {@inheritdoc}
45-
*/
46-
public function supportsClass($class)
47-
{
48-
return true;
49-
}
50-
5135
/**
5236
* {@inheritdoc}
5337
*/
@@ -76,4 +60,9 @@ protected function extractRoles(TokenInterface $token)
7660
{
7761
return $token->getRoles();
7862
}
63+
64+
private function supportsAttribute($attribute)
65+
{
66+
return 0 === strpos($attribute, $this->prefix);
67+
}
7968
}

‎src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
-20Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -137,24 +137,4 @@ protected function getVoter($vote)
137137

138138
return $voter;
139139
}
140-
141-
protected function getVoterSupportsClass($ret)
142-
{
143-
$voter = $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface');
144-
$voter->expects($this->any())
145-
->method('supportsClass')
146-
->will($this->returnValue($ret));
147-
148-
return $voter;
149-
}
150-
151-
protected function getVoterSupportsAttribute($ret)
152-
{
153-
$voter = $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface');
154-
$voter->expects($this->any())
155-
->method('supportsAttribute')
156-
->will($this->returnValue($ret));
157-
158-
return $voter;
159-
}
160140
}

‎src/Symfony/Component/Security/Core/Tests/Authorization/Voter/AuthenticatedVoterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Tests/Authorization/Voter/AuthenticatedVoterTest.php
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717

1818
class AuthenticatedVoterTest extends \PHPUnit_Framework_TestCase
1919
{
20-
public function testSupportsClass()
21-
{
22-
$voter = new AuthenticatedVoter($this->getResolver());
23-
$this->assertTrue($voter->supportsClass('stdClass'));
24-
}
25-
2620
/**
2721
* @dataProvider getVoteTests
2822
*/

‎src/Symfony/Component/Security/Core/Tests/Authorization/Voter/ExpressionVoterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Tests/Authorization/Voter/ExpressionVoterTest.php
-9Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@
1717

1818
class ExpressionVoterTest extends \PHPUnit_Framework_TestCase
1919
{
20-
public function testSupportsAttribute()
21-
{
22-
$expression = $this->createExpression();
23-
$expressionLanguage = $this->getMock('Symfony\Component\Security\Core\Authorization\ExpressionLanguage');
24-
$voter = new ExpressionVoter($expressionLanguage, $this->createTrustResolver(), $this->createRoleHierarchy());
25-
26-
$this->assertTrue($voter->supportsAttribute($expression));
27-
}
28-
2920
/**
3021
* @dataProvider getVoteTests
3122
*/

‎src/Symfony/Component/Security/Core/Tests/Authorization/Voter/RoleVoterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Tests/Authorization/Voter/RoleVoterTest.php
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717

1818
class RoleVoterTest extends \PHPUnit_Framework_TestCase
1919
{
20-
public function testSupportsClass()
21-
{
22-
$voter = new RoleVoter();
23-
24-
$this->assertTrue($voter->supportsClass('Foo'));
25-
}
26-
2720
/**
2821
* @dataProvider getVoteTests
2922
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.