Class PermissionHeuristic

java.lang.Object
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

 
  • Constructor Details

    • PermissionHeuristic

      public PermissionHeuristic()
  • Method Details

    • 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:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also:
    • 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:
    • collectionToString

      public static String collectionToString(Collection<PermissionHeuristic> permissionHeuristics)
      convert a collection to string
      Parameters:
      permissionHeuristics -
      Returns:
      the string