8000 [Security] RoleHierarchy returns unique an unique array of roles · symfony/symfony@aa0494c · GitHub
[go: up one dir, main page]

Skip to content

Commit aa0494c

Browse files
committed
[Security] RoleHierarchy returns unique an unique array of roles
1 parent 29b88af commit aa0494c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Symfony/Component/Security/Core/Role/RoleHierarchy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function getReachableRoleNames(array $roles): array
4848
}
4949
}
5050

51-
return $reachableRoles;
51+
return array_values(array_unique($reachableRoles));
5252
}
5353

5454
protected function buildRoleMap()

src/Symfony/Component/Security/Core/Tests/Role/RoleHierarchyTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ public function testGetReachableRoleNames()
2828
$this->assertEquals(['ROLE_ADMIN', 'ROLE_USER'], $role->getReachableRoleNames(['ROLE_ADMIN']));
2929
$this->assertEquals(['ROLE_FOO', 'ROLE_ADMIN', 'ROLE_USER'], $role->getReachableRoleNames(['ROLE_FOO', 'ROLE_ADMIN']));
3030
$this->assertEquals(['ROLE_SUPER_ADMIN', 'ROLE_ADMIN', 'ROLE_FOO', 'ROLE_USER'], $role->getReachableRoleNames(['ROLE_SUPER_ADMIN']));
31+
$this->assertEquals(['ROLE_SUPER_ADMIN', 'ROLE_ADMIN', 'ROLE_FOO', 'ROLE_USER'], $role->getReachableRoleNames(['ROLE_SUPER_ADMIN', 'ROLE_SUPER_ADMIN']));
3132
}
3233
}

0 commit comments

Comments
 (0)
0