Class RBACService
- java.lang.Object
-
- fr.paris.lutece.portal.service.rbac.RBACService
-
public final class RBACService extends java.lang.ObjectThis class provides the main methods to control the access to a resource depending on the user's roles
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <E extends fr.paris.lutece.portal.service.rbac.RBACAction>
java.util.Collection<E>getAuthorizedActionsCollection(java.util.Collection<E> collection, fr.paris.lutece.portal.service.rbac.RBACResource resource, fr.paris.lutece.api.user.User user)Filter a collection of RBACAction for a given userstatic <E extends fr.paris.lutece.portal.service.rbac.RBACAction>
java.util.Collection<E>getAuthorizedActionsCollection(java.util.Collection<E> collection, fr.paris.lutece.portal.service.rbac.RBACResource resource, AdminUser user)Deprecated.use getAuthorizedActionsCollection( Collection, RBACResource, User )static <E extends fr.paris.lutece.portal.service.rbac.RBACResource>
java.util.Collection<E>getAuthorizedCollection(java.util.Collection<E> collection, java.lang.String strPermission, fr.paris.lutece.api.user.User user)Filter a collection of resources for a given userstatic <E extends fr.paris.lutece.portal.service.rbac.RBACResource>
java.util.Collection<E>getAuthorizedCollection(java.util.Collection<E> collection, java.lang.String strPermission, AdminUser user)Deprecated.use getAuthorizedCollection( Collection, String, User )static ReferenceListgetAuthorizedReferenceList(ReferenceList listResources, java.lang.String strResourceType, java.lang.String strPermission, fr.paris.lutece.api.user.User user)Filter a Reference List for a given userstatic ReferenceListgetAuthorizedReferenceList(ReferenceList listResources, java.lang.String strResourceType, java.lang.String strPermission, AdminUser user)Deprecated.use getAuthorizedReferenceList( ReferenceList, String, String, User )static booleanisAuthorized(fr.paris.lutece.portal.service.rbac.RBACResource resource, java.lang.String strPermission, fr.paris.lutece.api.user.User user)Check that a given user is allowed to access a resource for a given permissionstatic booleanisAuthorized(fr.paris.lutece.portal.service.rbac.RBACResource resource, java.lang.String strPermission, AdminUser user)Deprecated.use isAuthorized( RBACResource, String, User )static booleanisAuthorized(java.lang.String strResourceTypeCode, java.lang.String strResourceId, java.lang.String strPermission, fr.paris.lutece.api.user.User user)Check that a given user is allowed to access a resource for a given permissionstatic booleanisAuthorized(java.lang.String strResourceTypeCode, java.lang.String strResourceId, java.lang.String strPermission, AdminUser user)Deprecated.use isAuthorized( String, String, String, User )static booleanisUserInRole(fr.paris.lutece.api.user.User user, java.lang.String strRole)Check that a given user is in the given rolestatic booleanisUserInRole(AdminUser user, java.lang.String strRole)Deprecated.use isUserInRole( User, String )
-
-
-
Method Detail
-
isAuthorized
public static boolean isAuthorized(java.lang.String strResourceTypeCode, java.lang.String strResourceId, java.lang.String strPermission, fr.paris.lutece.api.user.User user)Check that a given user is allowed to access a resource for a given permission- Parameters:
strResourceTypeCode- the key of the resource type being consideredstrResourceId- the id of the resource being consideredstrPermission- the permission neededuser- the user trying to access the ressource- Returns:
- true if the user can access the given resource with the given permission, false otherwise
-
isAuthorized
@Deprecated public static boolean isAuthorized(java.lang.String strResourceTypeCode, java.lang.String strResourceId, java.lang.String strPermission, AdminUser user)Deprecated.use isAuthorized( String, String, String, User )Check that a given user is allowed to access a resource for a given permission- Parameters:
strResourceTypeCode- the key of the resource type being consideredstrResourceId- the id of the resource being consideredstrPermission- the permission neededuser- the user trying to access the ressource- Returns:
- true if the user can access the given resource with the given permission, false otherwise
-
isAuthorized
public static boolean isAuthorized(fr.paris.lutece.portal.service.rbac.RBACResource resource, java.lang.String strPermission, fr.paris.lutece.api.user.User user)Check that a given user is allowed to access a resource for a given permission- Parameters:
resource- the resource object being consideredstrPermission- the permission neededuser- the user trying to access the ressource- Returns:
- true if the user can access the given resource with the given permission, false otherwise
-
isAuthorized
@Deprecated public static boolean isAuthorized(fr.paris.lutece.portal.service.rbac.RBACResource resource, java.lang.String strPermission, AdminUser user)Deprecated.use isAuthorized( RBACResource, String, User )Check that a given user is allowed to access a resource for a given permission- Parameters:
resource- the resource object being consideredstrPermission- the permission neededuser- the user trying to access the ressource- Returns:
- true if the user can access the given resource with the given permission, false otherwise
-
isUserInRole
public static boolean isUserInRole(fr.paris.lutece.api.user.User user, java.lang.String strRole)Check that a given user is in the given role- Parameters:
user- The userstrRole- The role- Returns:
- true if the user has the given role, false otherwise
-
isUserInRole
@Deprecated public static boolean isUserInRole(AdminUser user, java.lang.String strRole)
Deprecated.use isUserInRole( User, String )Check that a given user is in the given role- Parameters:
user- The userstrRole- The role- Returns:
- true if the user has the given role, false otherwise
-
getAuthorizedCollection
public static <E extends fr.paris.lutece.portal.service.rbac.RBACResource> java.util.Collection<E> getAuthorizedCollection(java.util.Collection<E> collection, java.lang.String strPermission, fr.paris.lutece.api.user.User user)Filter a collection of resources for a given user- Type Parameters:
E- The RBAC resource- Parameters:
collection- The collection to filterstrPermission- Permission to checkuser- The user- Returns:
- A filtered collection of resources
-
getAuthorizedCollection
@Deprecated public static <E extends fr.paris.lutece.portal.service.rbac.RBACResource> java.util.Collection<E> getAuthorizedCollection(java.util.Collection<E> collection, java.lang.String strPermission, AdminUser user)Deprecated.use getAuthorizedCollection( Collection, String, User )Filter a collection of resources for a given user- Type Parameters:
E- The RBAC resource- Parameters:
collection- The collection to filterstrPermission- Permission to checkuser- The user- Returns:
- A filtered collection of resources
-
getAuthorizedReferenceList
public static ReferenceList getAuthorizedReferenceList(ReferenceList listResources, java.lang.String strResourceType, java.lang.String strPermission, fr.paris.lutece.api.user.User user)
Filter a Reference List for a given user- Parameters:
listResources- The list to filterstrResourceType- The resource typestrPermission- The permission to checkuser- The user- Returns:
- The filtered collection
-
getAuthorizedReferenceList
@Deprecated public static ReferenceList getAuthorizedReferenceList(ReferenceList listResources, java.lang.String strResourceType, java.lang.String strPermission, AdminUser user)
Deprecated.use getAuthorizedReferenceList( ReferenceList, String, String, User )Filter a Reference List for a given user- Parameters:
listResources- The list to filterstrResourceType- The resource typestrPermission- The permission to checkuser- The user- Returns:
- The filtered collection
-
getAuthorizedActionsCollection
public static <E extends fr.paris.lutece.portal.service.rbac.RBACAction> java.util.Collection<E> getAuthorizedActionsCollection(java.util.Collection<E> collection, fr.paris.lutece.portal.service.rbac.RBACResource resource, fr.paris.lutece.api.user.User user)Filter a collection of RBACAction for a given user- Type Parameters:
E- The RBAC resource- Parameters:
collection- The collection to filterresource- The resourceuser- The user- Returns:
- The filtered collection
-
getAuthorizedActionsCollection
@Deprecated public static <E extends fr.paris.lutece.portal.service.rbac.RBACAction> java.util.Collection<E> getAuthorizedActionsCollection(java.util.Collection<E> collection, fr.paris.lutece.portal.service.rbac.RBACResource resource, AdminUser user)Deprecated.use getAuthorizedActionsCollection( Collection, RBACResource, User )Filter a collection of RBACAction for a given user- Type Parameters:
E- The RBAC resource- Parameters:
collection- The collection to filterresource- The resourceuser- The user- Returns:
- The filtered collection
-
-