Class RBACService
java.lang.Object
fr.paris.lutece.portal.service.rbac.RBACService
This class provides the main methods to control the access to a resource depending on the user's roles
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E extends fr.paris.lutece.portal.service.rbac.RBACAction>
Collection<E>getAuthorizedActionsCollection(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>
Collection<E>getAuthorizedActionsCollection(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>
Collection<E>getAuthorizedCollection(Collection<E> collection, 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>
Collection<E>getAuthorizedCollection(Collection<E> collection, String strPermission, AdminUser user) Deprecated.use getAuthorizedCollection( Collection, String, User )static ReferenceListgetAuthorizedReferenceList(ReferenceList listResources, String strResourceType, String strPermission, fr.paris.lutece.api.user.User user) Filter a Reference List for a given userstatic ReferenceListgetAuthorizedReferenceList(ReferenceList listResources, String strResourceType, String strPermission, AdminUser user) Deprecated.use getAuthorizedReferenceList( ReferenceList, String, String, User )static booleanisAuthorized(fr.paris.lutece.portal.service.rbac.RBACResource resource, 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, String strPermission, AdminUser user) Deprecated.use isAuthorized( RBACResource, String, User )static booleanisAuthorized(String strResourceTypeCode, String strResourceId, 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(String strResourceTypeCode, String strResourceId, String strPermission, AdminUser user) Deprecated.use isAuthorized( String, String, String, User )static booleanisUserInRole(fr.paris.lutece.api.user.User user, String strRole) Check that a given user is in the given rolestatic booleanisUserInRole(AdminUser user, String strRole) Deprecated.use isUserInRole( User, String )
-
Method Details
-
isAuthorized
public static boolean isAuthorized(String strResourceTypeCode, String strResourceId, 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(String strResourceTypeCode, String strResourceId, 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, 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, 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
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.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> Collection<E> getAuthorizedCollection(Collection<E> collection, 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> Collection<E> getAuthorizedCollection(Collection<E> collection, 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, String strResourceType, 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, String strResourceType, 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> Collection<E> getAuthorizedActionsCollection(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> Collection<E> getAuthorizedActionsCollection(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
-