Class AccessControlContext
- java.lang.Object
-
- org.silverpeas.core.security.authorization.AccessControlContext
-
public class AccessControlContext extends Object
This class permits to define the context of access to a resource.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
get(String key, Class<T> classType)
Gets from context a value from a key that has been stored into the context instance.Set<AccessControlOperation>
getOperations()
Gets the operations performed into the context.static AccessControlContext
init()
Gets an initialized instance of access control context.AccessControlContext
onOperationsOf(AccessControlOperation... operations)
Defines the operations performed into the context.<T> AccessControlContext
put(String key, T value)
Puts into context a value linked to a key.AccessControlContext
removeOperationsOf(AccessControlOperation... operations)
Removes the operations from the context.
-
-
-
Method Detail
-
init
public static AccessControlContext init()
Gets an initialized instance of access control context.- Returns:
- an empty
AccessControlContext
instance.
-
onOperationsOf
public AccessControlContext onOperationsOf(AccessControlOperation... operations)
Defines the operations performed into the context.- Parameters:
operations
- one or severalAccessControlOperation
instances.- Returns:
- the completed context itself.
-
removeOperationsOf
public AccessControlContext removeOperationsOf(AccessControlOperation... operations)
Removes the operations from the context. This is an explicit method that allowsAccessController
implementations to adjust the context by adding (forcing) an operation before a treatment and removing it when done.- Parameters:
operations
- one or severalAccessControlOperation
instances.- Returns:
- the context itself.
-
getOperations
public Set<AccessControlOperation> getOperations()
Gets the operations performed into the context.- Returns:
- a set of
AccessControlOperation
instances.
-
put
public <T> AccessControlContext put(String key, T value)
Puts into context a value linked to a key.- Type Parameters:
T
- the type of resource the access control is performed.- Parameters:
key
- the key.value
- the value.- Returns:
- the current instance.
-
get
public <T> T get(String key, Class<T> classType)
Gets from context a value from a key that has been stored into the context instance.- Type Parameters:
T
- the type of resource the access control is performed.- Parameters:
key
- the key associated to the searched value.classType
- the type of expected value.- Returns:
- the value if any, null if the expected type does not match with the one of the existing value.
-
-