Class AbstractAccessController<T>
- java.lang.Object
-
- org.silverpeas.core.security.authorization.AbstractAccessController<T>
-
- All Implemented Interfaces:
AccessController<T>
- Direct Known Subclasses:
ComponentAccessController
,GrantedAccessController
,NodeAccessController
,PublicationAccessController
,SimpleDocumentAccessController
,SpaceAccessController
public abstract class AbstractAccessController<T> extends Object implements AccessController<T>
This abstract class provides common implementation about the access controller :- - cache provider
- - user roles
-
-
Constructor Summary
Constructors Constructor Description AbstractAccessController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
fillUserRoles(Set<SilverpeasRole> userRoles, AccessControlContext context, String userId, T object)
Fills in the specified set the roles the user plays for the given resource in Silverpeas according to the specified access context.Stream<T>
filterAuthorizedByUser(Collection<T> objects, String userId)
Filters the given object list in order to keep those the specified user is authorized on.Stream<T>
filterAuthorizedByUser(Collection<T> objects, String userId, AccessControlContext context)
Filters the given object list in order to keep those the specified user is authorized on.Set<SilverpeasRole>
getUserRoles(String userId, T object, AccessControlContext context)
Gets the user roles about the aimed object and by taking in account the context of the access.boolean
isUserAuthorized(String userId, T object)
Checks if the specified user may access the specified object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.security.authorization.AccessController
isGroupAuthorized, isUserAuthorized, isUserAuthorized, isUserAuthorized
-
-
-
-
Method Detail
-
filterAuthorizedByUser
public Stream<T> filterAuthorizedByUser(Collection<T> objects, String userId)
Description copied from interface:AccessController
Filters the given object list in order to keep those the specified user is authorized on.This aim of this method is to be as efficient as possible on large volume of data.
- Specified by:
filterAuthorizedByUser
in interfaceAccessController<T>
- Parameters:
objects
- the objects to filter.userId
- the unique identifier of the user.- Returns:
- true if access is granted - false otherwise.
-
filterAuthorizedByUser
public Stream<T> filterAuthorizedByUser(Collection<T> objects, String userId, AccessControlContext context)
Description copied from interface:AccessController
Filters the given object list in order to keep those the specified user is authorized on.This aim of this method is to be as efficient as possible on large volume of data.
- Specified by:
filterAuthorizedByUser
in interfaceAccessController<T>
- Parameters:
objects
- the objects to filter.userId
- the unique identifier of the user.context
- the context in which the object is accessed.- Returns:
- true if access is granted - false otherwise.
-
isUserAuthorized
public final boolean isUserAuthorized(String userId, T object)
Description copied from interface:AccessController
Checks if the specified user may access the specified object.- Specified by:
isUserAuthorized
in interfaceAccessController<T>
- Parameters:
userId
- the unique identifier of the user.object
- the object to be accessed.- Returns:
- true if access is granted - false otherwise.
-
getUserRoles
public final Set<SilverpeasRole> getUserRoles(String userId, T object, AccessControlContext context)
Description copied from interface:AccessController
Gets the user roles about the aimed object and by taking in account the context of the access. After a first call, user role are cached (REQUEST live time) in order to increase the performances in case of several call on the same user and object.- Specified by:
getUserRoles
in interfaceAccessController<T>
- Parameters:
userId
- the unique identifier of the user.object
- the object to be accessed.context
- the context in which the object is accessed.- Returns:
- the role the user has about a resource and according to a context.
-
fillUserRoles
protected void fillUserRoles(Set<SilverpeasRole> userRoles, AccessControlContext context, String userId, T object)
Fills in the specified set the roles the user plays for the given resource in Silverpeas according to the specified access context.- Parameters:
userRoles
- the set to fill in.context
- the context defining the type of access with some additional parameters.userId
- the unique identifier of the user.object
- the resource in Silverpeas accessed by the user.
-
-