edu.internet2.middleware.grouper.permissions
Class PermissionHeuristic

java.lang.Object
  extended by edu.internet2.middleware.grouper.permissions.PermissionHeuristic

public class PermissionHeuristic
extends Object

 this takes a permissions assignment (PermissionEntry), and 
 gives it a score so you can find the best entry, even if it is 
 a tie, to decide if allow or deny.
 
 Max depth resource: 30 (configurable in grouper.properties)
 
 (864000) person/role assignment
 
 (432000) direct role assignment (14400 * 30)
 
 (14400) role assignment with role depth 29
 
 (7200) assignment to user as opposed to group

 (3600) direct resource assignment (120*30)
 
 (120) indirect direct resource assignment depth 29

 (60) direct action assignment (2*30)

 (58) action depth 1

 (56) action depth 2

 (54) action depth 3

 (2) action depth 29

 (1) allow

 

Author:
mchyzer

Nested Class Summary
static class PermissionHeuristic.PermissionHeuristicType
          which type of heuristic (not including depth)
 
Constructor Summary
PermissionHeuristic()
           
 
Method Summary
static List<PermissionHeuristic.PermissionHeuristicType> allTypesOrdered()
          get all types ordered by most important
static String collectionToString(Collection<PermissionHeuristic> permissionHeuristics)
          convert a collection to string
static PermissionHeuristics computeHeuristics(long score)
          computer heuristics
static long computePermissionHeuristic(PermissionEntry permissionEntry)
          compute a heuristic based on how important the aspects of the permissionEntry are see the class javadoc for more info
 boolean equals(Object obj)
           
 int getDepth()
          if this is a heuristic which has depth, then this is it, or -1
 PermissionHeuristic.PermissionHeuristicType getPermissionHeuristicType()
          type of heuristic
 int hashCode()
           
 void setDepth(int depth1)
          if this is a heuristic which has depth, then this is it, or -1
 void setPermissionHeuristicType(PermissionHeuristic.PermissionHeuristicType permissionHeuristicType1)
          type of heuristic
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PermissionHeuristic

public PermissionHeuristic()
Method Detail

getPermissionHeuristicType

public PermissionHeuristic.PermissionHeuristicType getPermissionHeuristicType()
type of heuristic

Returns:
type

setPermissionHeuristicType

public void setPermissionHeuristicType(PermissionHeuristic.PermissionHeuristicType permissionHeuristicType1)
type of heuristic

Parameters:
permissionHeuristicType1 -

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
Returns:
object equals
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

getDepth

public int getDepth()
if this is a heuristic which has depth, then this is it, or -1

Returns:
heuristic

setDepth

public void setDepth(int depth1)
if this is a heuristic which has depth, then this is it, or -1

Parameters:
depth1 -

allTypesOrdered

public static List<PermissionHeuristic.PermissionHeuristicType> allTypesOrdered()
get all types ordered by most important

Returns:
all types

computeHeuristics

public static PermissionHeuristics computeHeuristics(long score)
computer heuristics

Parameters:
score -
Returns:
the list of heuristics, e.g. for comparison

computePermissionHeuristic

public static long computePermissionHeuristic(PermissionEntry permissionEntry)
compute a heuristic based on how important the aspects of the permissionEntry are see the class javadoc for more info

Parameters:
permissionEntry -
Returns:
the number

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

collectionToString

public static String collectionToString(Collection<PermissionHeuristic> permissionHeuristics)
convert a collection to string

Parameters:
permissionHeuristics -
Returns:
the string