Class SecurityUtils

java.lang.Object
ch.tocco.nice2.dms.api.security.SecurityUtils

public class SecurityUtils extends Object

This helper class provides static methods for simple security stuff.

  • Method Details

    • hasReadPermission

      public static boolean hasReadPermission(ContentTreeNode contentTreeNode, String field, boolean checkPathOnly)
      Check if the current user is granted to read the given ContentTreeNode.
      Parameters:
      contentTreeNode - the node to check.
      Returns:
      true if the user is granted to read the node, else false.
    • hasReadPermission

      public static boolean hasReadPermission(Entity entity)
      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

      public static boolean hasReadPermission(Entity entity, String field)
    • hasReadPermission

      public static boolean hasReadPermission(Entity entity, String field, boolean checkPathOnly)
    • hasWritePermission

      public static boolean hasWritePermission(Entity entity)
      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

      public static boolean hasWritePermission(Entity entity, String field)
    • hasDeletePermission

      public static boolean hasDeletePermission(Entity entity)
    • hasPermissionEditPermission

      public static Predicate<ContentTreeNode> 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

      public static boolean hasRole(String role)
      Check if the current user has a certain role.
      Parameters:
      role - The role to check.
      Returns:
      true if the current user has the role.