Class RoleRepositoryProviderUtils<T extends BaseRole>
RoleRepository delegate working with RoleProvider
to this class. The class is responsible for searching for roles in multiple role providers, for deleting roles from
providers.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandeleteRole(String roleCode) @Nullable TfindRoleByCodeExcludeVisited(String roleCode, Set<String> visited, BiConsumer<T, T> roleMergingOperation) Finds a role by its code and merges its child roles into it, at all levels.getAllRoles(boolean includePolicies)
-
Constructor Details
-
RoleRepositoryProviderUtils
-
-
Method Details
-
deleteRole
-
getAllRoles
-
getAllRoles
-
findRoleByCodeExcludeVisited
public @Nullable T findRoleByCodeExcludeVisited(String roleCode, Set<String> visited, BiConsumer<T, T> roleMergingOperation) Finds a role by its code and merges its child roles into it, at all levels.The role is taken from the first provider that has it. Then each of its child roles is found the same way, with its own child roles already merged, and is passed together with the role to
roleMergingOperation. The operation changes the role object returned by the provider, usually by adding the policies of the child role to the role's policies of all levels.The child roles of a role with the
RoleSource.ANNOTATED_CLASSsource are not merged, because its policies already include the policies of the role interfaces it extends.visitedcollects the codes of the roles found during the call, includingroleCode. A child role whose code is already in it is skipped, so a cycle of child roles ends, and a child role that is reachable by several paths is merged only on the first path.- Parameters:
roleCode- the code of the role to findvisited- the codes of the roles that must not be merged again; the method adds codes to itroleMergingOperation- the operation that merges a child role (second argument) into a role (first argument)- Returns:
- the role with its child roles merged, or null if no provider has a role with this code
-