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

Fix RBAC for floating ips #963

Merged
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
16 changes: 3 additions & 13 deletions app/controllers/floating_ip_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,17 @@ def create_finished

def delete_floating_ips
assert_privileges("floating_ip_delete")

floating_ips = if @lastaction == "show_list" || (@lastaction == "show" && @layout != "floating_ip")
find_checked_items
find_checked_records_with_rbac(FloatingIp)
else
[params[:id]]
[find_record_with_rbac(FloatingIp, params[:id])]
end

if floating_ips.empty?
add_flash(_("No Floating IPs were selected for deletion."), :error)
end

floating_ips_to_delete = []
floating_ips.each do |s|
floating_ip = FloatingIp.find(s)
if floating_ip.nil?
add_flash(_("Floating IP no longer exists."), :error)
else
floating_ips_to_delete.push(floating_ip)
end
end
process_floating_ips(floating_ips_to_delete, "destroy") unless floating_ips_to_delete.empty?
process_floating_ips(floating_ips, "destroy") unless floating_ips.empty?

# refresh the list if applicable
if @lastaction == "show_list"
Expand Down