Class AccessPolicy

java.lang.Object
org.gcube.vremanagement.executor.rest.AccessPolicy

public class AccessPolicy extends Object
Who may do what on the Smart Executor, from the roles in the token of the caller.
  • "SmartExecutor-Manager" in the Context, or "Infrastructure-Manager": launch, stop and remove tasks, and read every task of the Context;
  • anybody else with a token of the Context: the list of the plugins, and the tasks and states of the tasks they launched.
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • SMART_EXECUTOR_MANAGER

      public static final String SMART_EXECUTOR_MANAGER
      The role of who manages the tasks of the Smart Executor in a Context.
      See Also:
    • INFRASTRUCTURE_MANAGER

      public static final String INFRASTRUCTURE_MANAGER
      The role of who manages the whole infrastructure.
      See Also:
    • MANAGER_ROLES

      public static final Set<String> MANAGER_ROLES
      The roles that manage the tasks.
  • Method Details

    • isManager

      public static boolean isManager()
      Returns:
      whether the caller manages the tasks of the Context
    • checkManager

      public static void checkManager()
      Throws:
      jakarta.ws.rs.ForbiddenException - if the caller does not manage the tasks of the Context
    • canRead

      public static boolean canRead(String ownerId)
      Parameters:
      ownerId - the identifier of who launched a task, null when it is not known
      Returns:
      whether the caller may read that task: a manager, or who launched it
    • checkCanRead

      public static void checkCanRead(String ownerId)
      Parameters:
      ownerId - the identifier of who launched a task, null when it is not known
      Throws:
      jakarta.ws.rs.ForbiddenException - if the caller may not read that task