Commit 445f0f1
committed
minor #47144 [Security] Remove using multiple attributes with #[IsGranted] (HypeMC)
This PR was merged into the 6.2 branch.
Discussion
----------
[Security] Remove using multiple attributes with #[IsGranted]
| Q | A
| ------------- | ---
| Branch? | 6.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #46978 (comment)
| License | MIT
| Doc PR | -
Passing multiple attributes to `isGranted()` has been removed in #33584, so the following doesn't work any more:
```php
#[IsGranted(attributes: ['ROLE_ADMIN'])]
public function index(Post $post)
{
}
#[IsGranted(attributes: ['ROLE_USER', 'ROLE_ADMIN'])]
public function index(Post $post)
{
}
```
As mentioned in sensiolabs/SensioFrameworkExtraBundle#648 , expressions should be used instead, see #46978 . This PR removes the possibility of using multiple attributes with `#[IsGranted]`.
Also, it's currently possible to use `#[IsGranted()]` with no attributes (`null`). Since this doesn't seem to work either, nor can I find a reason why it even should, this PR removes that option as well. If I'm wrong about this one, please let me know.
Commits
-------
663dc3e [Security] Remove using multiple attributes with #[IsGranted]File tree
5 files changed
+23
-39
lines changed- src/Symfony/Component/Security/Http
- Attribute
- EventListener
- Tests
- EventListener
- Fixtures
5 files changed
+23
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
| 86 | + | |
88 | 87 | | |
89 | | - | |
90 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| |||
Lines changed: 7 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 219 | + | |
223 | 220 | | |
224 | 221 | | |
225 | 222 | | |
| |||
236 | 233 | | |
237 | 234 | | |
238 | 235 | | |
239 | | - | |
| 236 | + | |
240 | 237 | | |
241 | | - | |
| 238 | + | |
242 | 239 | | |
243 | 240 | | |
244 | 241 | | |
| |||
247 | 244 | | |
248 | 245 | | |
249 | 246 | | |
250 | | - | |
251 | | - | |
252 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
253 | 250 | | |
254 | 251 | | |
255 | 252 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
Lines changed: 5 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 22 | + | |
28 | 23 | | |
29 | 24 | | |
30 | 25 | | |
31 | 26 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 27 | + | |
43 | 28 | | |
44 | 29 | | |
45 | 30 | | |
46 | 31 | | |
47 | | - | |
| 32 | + | |
48 | 33 | | |
49 | 34 | | |
50 | 35 | | |
51 | 36 | | |
52 | | - | |
| 37 | + | |
53 | 38 | | |
54 | 39 | | |
55 | 40 | | |
56 | 41 | | |
57 | | - | |
| 42 | + | |
58 | 43 | | |
59 | 44 | | |
60 | 45 | | |
| |||
0 commit comments