-
Notifications
You must be signed in to change notification settings - Fork 6k
Add a factory method for RoleHierarchyImpl #13788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@making, I like this idea; however, I'd prefer that it not be on the implementation. Usually, this is addressed in Spring Security with a factory class like public final class RoleHierarchies {
public static RoleHierarchy of(String hierarchy) { ... }
public static RoleHierarchy of(Map<String, List<String>> hierarchy) { ... }
} Are you able to change the PR along these lines? |
I’ll do it |
The reason I created this factory method in the impl class is because the format of the string representation is highly dependent on |
Is this a map where directly assigned authority is the key and reachable authorities is the value? |
@making Good points.
Good point. Maybe instead what we do is deprecate the
No, I was thinking for the same implementation. It could use That said, a builder is probably better than taking a map, so instead let's just add the factory method to |
- Change to #fromHierarchy to match naming convention - Keep existing test methods the same - Deprecate setHierarchy and default constructor - Add private Map constructor - Change Adjust RoleHierarchyBuilder to use Map constructor Issue gh-13788
Currenctly Hierarchical Roles requires the setter method to define the hierarchy.
This PR adds a factory method for this use case to make it easier