Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitdce55f3

Browse files
committed
Deprecated ROLE_PREVIOUS_ADMIN
1 parentff9b8da commitdce55f3

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public function vote(TokenInterface $token, $subject, array $attributes)
4040
continue;
4141
}
4242

43+
if ('ROLE_PREVIOUS_ADMIN' ===$attribute) {
44+
trigger_deprecation('symfony/security-core','5.1','The ROLE_PREVIOUS_ADMIN role is deprecated and will be removed in version 6.0, use the IS_IMPERSONATOR attribute instead.');
45+
}
46+
4347
$result = VoterInterface::ACCESS_DENIED;
4448
foreach ($rolesas$role) {
4549
if ($attribute ===$role) {

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ public function getVoteTests()
4444
];
4545
}
4646

47+
/**
48+
* @group legacy
49+
* @expectedDeprecation Since symfony/security-core 5.1: The ROLE_PREVIOUS_ADMIN role is deprecated and will be removed in version 6.0, use the IS_IMPERSONATOR attribute instead.
50+
*/
51+
publicfunctiontestDeprecatedRolePreviousAdmin()
52+
{
53+
$voter =newRoleVoter();
54+
55+
$voter->vote($this->getTokenWithRoleNames(['ROLE_USER','ROLE_PREVIOUS_ADMIN']),null, ['ROLE_PREVIOUS_ADMIN']);
56+
}
57+
4758
protectedfunctiongetTokenWithRoleNames(array$roles)
4859
{
4960
$token =$this->getMockBuilder(AbstractToken::class)->getMock();

‎src/Symfony/Component/Security/Core/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"require": {
1919
"php":"^7.2.5",
2020
"symfony/event-dispatcher-contracts":"^1.1|^2",
21-
"symfony/service-contracts":"^1.1.6|^2"
21+
"symfony/service-contracts":"^1.1.6|^2",
22+
"symfony/deprecation-contracts":"^2.1"
2223
},
2324
"require-dev": {
2425
"psr/container":"^1.0",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp