1
0
mirror of synced 2026-08-04 09:17:02 +00:00

SEC-232: Additional updates to hierachical roles code from contributor.

This commit is contained in:
Luke Taylor
2007-09-19 22:10:31 +00:00
parent eb0307bcd9
commit 400a3b90f0
2 changed files with 42 additions and 16 deletions
@@ -14,21 +14,16 @@
package org.acegisecurity.userdetails.hierarchicalroles;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Arrays;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.*;
/**
* <p>
@@ -183,8 +178,8 @@ public class RoleHierarchyImpl implements RoleHierarchy {
if (rolesReachableInOneStepMap.containsKey(aRole)) {
Set newReachableRoles = (Set) rolesReachableInOneStepMap.get(aRole);
if (CollectionUtils.containsAny(rolesToVisitSet, newReachableRoles)
|| CollectionUtils.containsAny(visitedRolesSet, newReachableRoles)) {
// definition of a cycle: you can reach the role you are starting from
if (rolesToVisitSet.contains(role) || visitedRolesSet.contains(role)) {
throw new CycleInRoleHierarchyException();
} else {
// no cycle
@@ -200,4 +195,4 @@ public class RoleHierarchyImpl implements RoleHierarchy {
}
}
}