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 RBAC check to process_managers. #848

Merged
merged 2 commits into from
Mar 31, 2017
Merged
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
18 changes: 6 additions & 12 deletions app/controllers/application_controller/ci_processing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1979,22 +1979,14 @@ def process_objects(objs, task, display_name = nil)
end

def manager_button_operation(method, display_name)
items = []
if params[:id]
if params[:id].nil? || !ExtManagementSystem.where(:id => params[:id]).exists?
add_flash(_("%{record} no longer exists") % {:record => ui_lookup(:table => controller_name)}, :error)
else
items.push(find_id_with_rbac(ExtManagementSystem, params[:id]))
end
else
items = find_checked_ids_with_rbac(ExtManagementSystem)
end
items = params[:id] ? [params[:id]] : find_checked_items

if items.empty?
add_flash(_("No providers were selected for %{task}") % {:task => display_name}, :error)
else
process_managers(items, method) unless items.empty? && !flash_errors?
return
end

process_managers(items, method)
end

def process_managers(managers, task)
Expand All @@ -2007,6 +1999,8 @@ def process_managers(managers, task)
manager_ids, _services_out_region = filter_ids_in_region(managers, provider_class.to_s)
return if manager_ids.empty?

assert_rbac(provider_class, manager_ids)

options = {:ids => manager_ids, :task => task, :userid => session[:userid]}
kls = provider_class.find_by(:id => manager_ids.first).class
kls.process_tasks(options)
Expand Down