8000 Removed supports{Attribute,Class}() methods · symfony/symfony@2ea3de5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ea3de5

Browse files
committed
Removed supports{Attribute,Class}() methods
1 parent 967c0e4 commit 2ea3de5

File tree

4 files changed

+1
-150
lines changed

4 files changed

+1
-150
lines changed

src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -72,38 +72,6 @@ public function decide(TokenInterface $token, array $attributes, $object = null)
7272
return $this->{$this->strategy}($token, $attributes, $object);
7373
}
7474

75-
/**
76-
* {@inheritdoc}
77-
*/
78-
public function supportsAttribute($attribute)
79-
{
80-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.');
81-
82-
foreach ($this->voters as $voter) {
83-
if ($voter->supportsAttribute($attribute)) {
84-
return true;
85-
}
86-
}
87-
88-
return false;
89-
}
90-
91-
/**
92-
* {@inheritdoc}
93-
*/
94-
public function supportsClass($class)
95-
{
96-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.');
97-
98-
foreach ($this->voters as $voter) {
99-
if ($voter->supportsClass($class)) {
100-
return true;
101-
}
102-
}
103-
104-
return false;
105-
}
106-
10775
/**
10876
* Grants access if any voter returns an affirmative response.
10977
*

src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,4 @@ interface AccessDecisionManagerInterface
3030
* @return bool true if the access is granted, false otherwise
3131
*/
3232
public function decide(TokenInterface $token, array $attributes, $object = null);
33-
34-
/**
35-
* Checks if the access decision manager supports the given attribute.
36-
*
37-
* @param string $attribute An attribute
38-
*
39-
* @return bool true if this decision manager supports the attribute, false otherwise
40-
*
41-
* @deprecated since version 2.8, to be removed in 3.0.
42-
*/
43-
public function supportsAttribute($attribute);
44-
45-
/**
46-
* Checks if the access decision manager supports the given class.
47-
*
48-
* @param string $class A class name
49-
*
50-
* @return true if this decision manager can process the class
51-
*
52-
* @deprecated since version 2.8, to be removed in 3.0.
53-
*/
54-
public function supportsClass($class);
5533
}

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

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,6 @@
2121
*/
2222
abstract class AbstractVoter implements VoterInterface
2323
{
24-
/**
25-
* {@inheritdoc}
26-
*/
27-
public function supportsAttribute($attribute)
28-
{
29-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.');
30-
31-
return in_array($attribute, $this->getSupportedAttributes());
32-
}
33-
34-
/**
35-
* {@inheritdoc}
36-
*/
37-
public function supportsClass($class)
38-
{
39-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.');
40-
41-
foreach ($this->getSupportedClasses() as $supportedClass) {
42-
if ($supportedClass === $class || is_subclass_of($class, $supportedClass)) {
43-
return true;
44-
}
45-
}
46-
47-
return false;
48-
}
49-
5024
/**
5125
* Iteratively check all given attributes by calling isGranted.
5226
*
@@ -106,35 +80,12 @@ public function vote(TokenInterface $token, $object, array $attributes)
10680
* To determine if the passed class is instance B41A of the supported class, the
10781
* isClassInstanceOf() method can be used.
10882
*
109-
* This method will become abstract in 3.0.
110-
*
11183
* @param string $attribute An attribute
11284
* @param string $class The fully qualified class name of the passed object
11385
*
11486
* @return bool True if the attribute and class is supported, false otherwise
11587
*/
116-
protected function supports($attribute, $class)
117-
{
118-
@trigger_error('The getSupportedClasses and getSupportedAttributes methods are deprecated since version 2.8 and will be removed in version 3.0. Overwrite supports instead.');
119-
120-
$classIsSupported = false;
121-
foreach ($this->getSupportedClasses() as $supportedClass) {
122-
if ($this->isClassInstanceOf($class, $supportedClass)) {
123-
$classIsSupported = true;
124-
break;
125-
}
126-
}
127-
128-
if (!$classIsSupported) {
129-
return false;
130-
}
131-
132-
if (!in_array($attribute, $this->getSupportedAttributes())) {
133-
return false;
134-
}
135-
136-
return true;
137-
}
88+
F438 abstract protected function supports($attribute, $class);
13889

13990
/**
14091
* A helper method to test if the actual class is instanceof or equal
@@ -150,30 +101,6 @@ protected function isClassInstanceOf($actualClass, $expectedClass)
150101
return $expectedClass === $actualClass || is_subclass_of($actualClass, $expectedClass);
151102
}
152103

153-
/**
154-
* Return an array of supported classes. This will be called by supportsClass.
155-
*
156-
* @return array an array of supported classes, i.e. array('Acme\DemoBundle\Model\Product')
157-
*
158-
* @deprecated since version 2.8, to be removed in 3.0. Use supports() instead.
159-
*/
160-
protected function getSupportedClasses()
161-
{
162-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.');
163-
}
164-
165-
/**
166-
* Return an array of supported attributes. This will be called by supportsAttribute.
167-
*
168-
* @return array an array of supported attributes, i.e. array('CREATE', 'READ')
169-
*
170-
* @deprecated since version 2.8, to be removed in 3.0. Use supports() instead.
171-
*/
172-
protected function getSupportedAttributes()
173-
{
174-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.');
175-
}
176-
177104
/**
178105
* Perform a single access check operation on a given attribute, object and (optionally) user
179106
* It is safe to assume that $attribute and $object's class pass supportsAttribute/supportsClass

src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,6 @@ interface VoterInterface
2424
const ACCESS_ABSTAIN = 0;
2525
const ACCESS_DENIED = -1;
2626

27-
/**
28-
* Checks if the voter supports the given attribute.
29-
*
30-
* @param string $attribute An attribute
31-
*
32-
* @return bool true if this Voter supports the attribute, false otherwise
33-
*
34-
* @deprecated since version 2.8, to be removed in 3.0.
35-
*/
36-
public function supportsAttribute($attribute);
37-
38-
/**
39-
* Checks if the voter supports the given class.
40-
*
41-
* @param string $class A class name
42-
*
43-
* @return bool true if this Voter can process the class
44-
*
45-
* @deprecated since version 2.8, to be removed in 3.0.
46-
*/
47-
public function supportsClass($class);
48-
4927
/**
5028
* Returns the vote for the given parameters.
5129
*

0 commit comments

Comments
 (0)
0