/** * Adds inherited roles to a role set * * @param coll * @throws IOException */ public void addInheritedRoles(Collection<GeoServerRole> coll) throws IOException { Set<GeoServerRole> inherited = new HashSet<GeoServerRole>(); for (GeoServerRole role : coll) addParentRole(role, inherited); coll.addAll(inherited); }
/** * Collects the ascendents for a {@link GeoServerRole} object * * @param role * @param inherited */ protected void addParentRole(GeoServerRole role, Collection<GeoServerRole> inherited) throws IOException { GeoServerRole parentRole = getRoleService().getParentRole(role); if (parentRole == null) return; // end of recursion if (inherited.contains(parentRole)) return; // end of recursion inherited.add(parentRole); // recursion addParentRole(parentRole, inherited); }