private void gatherUniquePermissions( Role role, Collection<Permission> coll ) throws RbacManagerException { if ( role.getPermissions() != null ) { for ( Permission permission : role.getPermissions() ) { if ( !coll.contains( permission ) ) { coll.add( permission ); } } } if ( role.hasChildRoles() ) { Map<String, Role> childRoles = getChildRoles( role ); Iterator<Role> it = childRoles.values().iterator(); while ( it.hasNext() ) { Role child = it.next(); gatherUniquePermissions( child, coll ); } } }
throws RbacObjectNotFoundException, RbacManagerException if ( role.hasChildRoles() )
public Role getChildRole( RBACManager manager, Role role, String expectedChildRoleName, int childRoleCount ) throws RbacManagerException { assertTrue( role.hasChildRoles() ); List<String> childNames = role.getChildRoleNames(); assertNotNull( childNames ); assertEquals( 1, childNames.size() ); String childName = (String) childNames.get( 0 ); assertNotNull( childName ); Role childRole = manager.getRole( childName ); assertNotNull( childRole ); assertEquals( expectedChildRoleName, childRole.getName() ); return childRole; }