Skip to content

Commit

Permalink
Update load_workflows to add workflows shared to the Project
Browse files Browse the repository at this point in the history
  • Loading branch information
malchua committed Jan 13, 2025
1 parent a3c1bdb commit 0115044
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/controllers/workflow_executions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ def workflow_execution
end

def load_workflows
authorized_scope(WorkflowExecution, type: :relation, as: :user, scope_options: { user: current_user })
workflow_executions = authorized_scope(WorkflowExecution, type: :relation, as: :user_and_shared,
scope_options: { user: current_user })

shared_workflow_executions = []
workflow_executions.where(shared_with_namespace: true).find_each do |workflow_execution|
shared_workflow_executions.append(workflow_execution) if authorize! workflow_execution.namespace,
to: :view_workflow_executions?
end

workflow_executions.where(shared_with_namespace: false)
.or(workflow_executions.where(id: shared_workflow_executions.map(&:id)))
end

def workflow_execution_params
Expand Down

0 comments on commit 0115044

Please sign in to comment.