java.lang.Object
ch.tocco.nice2.persist.security.api.exec.SecTasks

public final class SecTasks extends Object
  • Method Details

    • getGuardTask

      public static <A> PersistTask<A,Guard> getGuardTask()
      Returns a task that finds a Guard for a given object.
    • getEntityGuard

      public static PersistTask<Entity,Guard> getEntityGuard()
      Returns a task that finds the guard of an given entity.
    • getEntityManagerGuard

      public static PersistTask<EntityManager,Guard> getEntityManagerGuard()
      Returns a task that finds the guard of a given entity manager.
    • askPermission

      public static PersistTask<Guard,Boolean> askPermission(String... permission)
      Checks whether the guard grants all the given permissions. It returns true on success and false otherwise.

      If a null guard is passed to the task, it will always return false.

    • askPermission

      public static PersistTask<Guard,Boolean> askPermission(Permission... permission)
      Checks whether the guard grants all the given permissions. It returns true on success and false otherwise.

      If a null guard is passed to the task, it will always return false.

    • checkPermission

      public static <A> PersistTask<A,A> checkPermission(String... permission)
      Returns a task that checks the given permissions against the guard of the entity and returns on successful authorization the same entity. If the check fails, an exception is thrown.
    • checkPermission

      public static <A> PersistTask<A,A> checkPermission(Permission... permission)
      Returns a task that checks the given permissions against the guard of the entity and returns on successful authorization the same entity. If the check fails, an exception is thrown.