Esri Geoportal Server
1.0

com.esri.gpt.framework.security.principal
Class RoleSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet<E>
              extended by java.util.LinkedHashSet<String>
                  extended by com.esri.gpt.framework.collection.StringSet
                      extended by com.esri.gpt.framework.security.principal.RoleSet
All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>, Collection<String>, Set<String>

public class RoleSet
extends StringSet

Maintains a set of role keys.

The intent is to use this set for quick evaluation of authorization constraints.

Each value in the collection is a String. Null values are ignored. Values are trimmed, zero-length Strings are ignored. The set is unique and is not case sensitive.

See Also:
Serialized Form

Constructor Summary
RoleSet()
          Default constructor.
 
Method Summary
 void assertRole(RoleSet roleSet)
          Asserts that the current user has at least one of the roles specified in the supplied role set.
 void assertRole(String roleKey)
          Asserts that the current user has a required role.
 boolean hasRole(RoleSet roleSet)
          Determines if the current set has at least one of the roles specified in the supplied role set.
 boolean hasRole(String roleKey)
          Determines if this set has a specified role.
 
Methods inherited from class com.esri.gpt.framework.collection.StringSet
add, addDelimited, clear, contains, containsString, getAllowEmptyValues, getIsCaseSensitive, getTrimValues, remove, remove, retainAll
 
Methods inherited from class java.util.HashSet
clone, isEmpty, iterator, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, isEmpty, iterator, removeAll, size, toArray, toArray
 

Constructor Detail

RoleSet

public RoleSet()
Default constructor.

Method Detail

assertRole

public void assertRole(String roleKey)
                throws NotAuthorizedException
Asserts that the current user has a required role.
If the user does not have the required role, a NotAuthorizedException exception is thrown.

Parameters:
roleKey - the key associated with the required role
Throws:
NotAuthorizedException - if the user does not have a required role

assertRole

public void assertRole(RoleSet roleSet)
                throws NotAuthorizedException
Asserts that the current user has at least one of the roles specified in the supplied role set.
If the user does not have the required role, a NotAuthorizedException exception is thrown.

Parameters:
roleSet - the set of roles to check
Throws:
NotAuthorizedException - if the user does not have a required role

hasRole

public boolean hasRole(String roleKey)
Determines if this set has a specified role.

Parameters:
roleKey - the key associated with the role to check

hasRole

public boolean hasRole(RoleSet roleSet)
Determines if the current set has at least one of the roles specified in the supplied role set.

Parameters:
roleSet - the set of roles to check

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.