Package ch.tocco.nice2.dms.api.security
Class SecurityUtils
java.lang.Object
ch.tocco.nice2.dms.api.security.SecurityUtils
This helper class provides static methods for simple security stuff.
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
hasDeletePermission
(Entity entity) static Predicate
<ContentTreeNode> Predicate to check whether the current user is granted to edit the permissions of a node.static boolean
hasReadPermission
(ContentTreeNode contentTreeNode, String field, boolean checkPathOnly) Check if the current user is granted to read the givenContentTreeNode
.static boolean
hasReadPermission
(Entity entity) Check if the current user is granted to read the given entity.static boolean
hasReadPermission
(Entity entity, String field) static boolean
hasReadPermission
(Entity entity, String field, boolean checkPathOnly) static boolean
Check if the current user has a certain role.static boolean
hasWritePermission
(Entity entity) Check if the current user is granted to write to the given entity.static boolean
hasWritePermission
(Entity entity, String field)
-
Method Details
-
hasReadPermission
public static boolean hasReadPermission(ContentTreeNode contentTreeNode, String field, boolean checkPathOnly) Check if the current user is granted to read the givenContentTreeNode
.- Parameters:
contentTreeNode
- the node to check.- Returns:
- true if the user is granted to read the node, else false.
-
hasReadPermission
Check if the current user is granted to read the given entity.- Parameters:
entity
- the entity to check.- Returns:
- true if the user is granted to read the entity, else false.
-
hasReadPermission
-
hasReadPermission
-
hasWritePermission
Check if the current user is granted to write to the given entity.- Parameters:
entity
- the entity to check.- Returns:
- true if the user is granted to write to the entity, else false.
-
hasWritePermission
-
hasDeletePermission
-
hasPermissionEditPermission
Predicate to check whether the current user is granted to edit the permissions of a node.- Returns:
- the predicate to check the permissions edit permission.
-
hasRole
Check if the current user has a certain role.- Parameters:
role
- The role to check.- Returns:
- true if the current user has the role.
-