show unique inherited roles
This commit is contained in:
parent
20485d1f9b
commit
7061bfbf3a
@ -82,7 +82,7 @@ class SecurityDataCollector extends DataCollector
|
|||||||
'token_class' => get_class($token),
|
'token_class' => get_class($token),
|
||||||
'user' => $token->getUsername(),
|
'user' => $token->getUsername(),
|
||||||
'roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $assignedRoles),
|
'roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $assignedRoles),
|
||||||
'inherited_roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $inheritedRoles),
|
'inherited_roles' => array_unique(array_map(function (RoleInterface $role) { return $role->getRole(); }, $inheritedRoles)),
|
||||||
'supports_role_hierarchy' => null !== $this->roleHierarchy,
|
'supports_role_hierarchy' => null !== $this->roleHierarchy,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,11 @@ class SecurityDataCollectorTest extends TestCase
|
|||||||
array('ROLE_ADMIN'),
|
array('ROLE_ADMIN'),
|
||||||
array('ROLE_USER', 'ROLE_ALLOWED_TO_SWITCH'),
|
array('ROLE_USER', 'ROLE_ALLOWED_TO_SWITCH'),
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
array('ROLE_ADMIN', 'ROLE_OPERATOR'),
|
||||||
|
array('ROLE_ADMIN', 'ROLE_OPERATOR'),
|
||||||
|
array('ROLE_USER', 'ROLE_ALLOWED_TO_SWITCH'),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +123,7 @@ class SecurityDataCollectorTest extends TestCase
|
|||||||
{
|
{
|
||||||
return new RoleHierarchy(array(
|
return new RoleHierarchy(array(
|
||||||
'ROLE_ADMIN' => array('ROLE_USER', 'ROLE_ALLOWED_TO_SWITCH'),
|
'ROLE_ADMIN' => array('ROLE_USER', 'ROLE_ALLOWED_TO_SWITCH'),
|
||||||
|
'ROLE_OPERATOR' => array('ROLE_USER'),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user