@groovy.transform.CompileStatic class MutableRoleHierarchy extends java.lang.Object implements RoleHierarchy
A mutable RoleHierarchy that allows the hierarchy definition to be replaced at runtime, working around the immutability of Spring Security's RoleHierarchyImpl.
Spring Security 6 made RoleHierarchyImpl effectively immutable by
removing public mutators in favour of RoleHierarchyImpl.fromHierarchy(...).
This class wraps a delegate that is rebuilt every time the hierarchy string is
assigned, so callers (such as the plugin's roleHierarchy bean and any
application code that reads grails.plugin.springsecurity.roleHierarchy
at runtime) keep their original setter-based API.
The hierarchy property uses the standard Spring Security syntax,
with one assignment per line, e.g.:
ROLE_ADMIN > ROLE_USER ROLE_USER > ROLE_GUEST
Setting the property to null or an empty string clears the hierarchy.
| Type | Name and description |
|---|---|
java.lang.String |
hierarchy |
| Constructor and description |
|---|
MutableRoleHierarchy() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
java.util.Collection<? extends GrantedAuthority> |
getReachableGrantedAuthorities(java.util.Collection<? extends GrantedAuthority> authorities) |
|
void |
setHierarchy(java.lang.String hierarchy) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |