Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MiqTask#deliver and execute #1249

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/controllers/api/request_tasks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
module Api
class RequestTasksController < BaseController
include Api::Mixins::ResourceCancel

# execute queues the work.
# this is typically called from within the workflow
def execute_resource(type, id, _data)
api_resource(type, id, "Executing") do |task|
raise BadRequestError, "Resource must be approved. state is #{task.state}" unless task.approved?

task.execute_queue
end
end
end
end
2 changes: 2 additions & 0 deletions config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3233,6 +3233,8 @@
:post:
- :name: cancel
:identifier: miq_request_control
- :name: execute
:identifier: miq_request_control
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Continung from #1249 (comment)

I still don't like this permission here...something feels off about it. I admit that miq_request_control is used for cancel, but being able to cancel your own request is very different from executing it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added 'you can only execute this if it has been approved' feels like it lessens the request.

:subcollection_actions:
:get:
- :name: read
Expand Down