Screened ip address can be edited, deleted, and changed to allow or block.

This commit is contained in:
Neil Lalonde
2013-10-22 16:30:30 -04:00
parent b8d586251c
commit 7d582fbee3
16 changed files with 259 additions and 16 deletions

View File

@ -1,8 +1,34 @@
class Admin::ScreenedIpAddressesController < Admin::AdminController
before_filter :fetch_screened_ip_address, only: [:update, :destroy]
def index
screened_emails = ScreenedIpAddress.limit(200).order('last_match_at desc').to_a
render_serialized(screened_emails, ScreenedIpAddressSerializer)
screened_ip_addresses = ScreenedIpAddress.limit(200).order('last_match_at desc').to_a
render_serialized(screened_ip_addresses, ScreenedIpAddressSerializer)
end
def update
if @screened_ip_address.update_attributes(allowed_params)
render json: success_json
else
render_json_error(@screened_ip_address)
end
end
def destroy
@screened_ip_address.destroy
render json: success_json
end
private
def allowed_params
params.require(:ip_address)
params.permit(:ip_address, :action_name)
end
def fetch_screened_ip_address
@screened_ip_address = ScreenedIpAddress.find(params[:id])
end
end