Implement resume workflow policy

What does this MR do and why?

**Summary by Duo**

This change adds a new "resume" permission for Duo workflows that allows users to restart workflows that are waiting for input. The permission is only granted to workflow owners when their workflow is in a specific "input required" state, meaning the workflow has paused and needs user interaction to continue. The implementation includes the necessary authorization rules, GraphQL API updates to expose the permission, and comprehensive tests to ensure it works correctly across different scenarios.

References

Relates to #594417 (closed)

How to set up and validate locally

  1. Run this graphQL query

    query getAgentFlows(
      $projectPath: ID!
      $after: String
      $before: String
      $first: Int
      $last: Int
      $search: String
      $sort: DuoWorkflowsWorkflowSort
      $statusGroup: DuoWorkflowStatusGroup
      $type: String
    ) {
      project(fullPath: $projectPath) {
        id
        duoWorkflowWorkflows(
          projectPath: $projectPath
          first: $first
          after: $after
          last: $last
          before: $before
          search: $search
          sort: $sort
          statusGroup: $statusGroup
          type: $type
        ) {
          pageInfo {
            startCursor
            endCursor
            hasNextPage
            hasPreviousPage
          }
          edges {
            node {
              ...FlowFragment
            }
          }
        }
      }
    }
    
    fragment FlowFragment on DuoWorkflow {
      id
      status
      userPermissions {
        updateDuoWorkflow
        resumeDuoWorkflow
      }
    }

Input variables

{
  "projectPath": "gitlab-duo/test",
  "before": null,
  "after": null,
  "first": 20,
  "last": null,
  "sort": "UPDATED_DESC",
  "statusGroup": null,
  "type": null
}
  1. You should see relevant resume workflows permissions when flow status is input_required and current_user is workflow owner.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading