2013-10-21 13:49:51 -05:00
|
|
|
class Admin::ScreenedIpAddressesController < Admin::AdminController
|
|
|
|
|
2013-10-22 15:30:30 -05:00
|
|
|
before_filter :fetch_screened_ip_address, only: [:update, :destroy]
|
|
|
|
|
2013-10-21 13:49:51 -05:00
|
|
|
def index
|
2013-10-23 11:56:50 -05:00
|
|
|
screened_ip_addresses = ScreenedIpAddress.limit(200).order('id desc').to_a
|
2013-10-22 15:30:30 -05:00
|
|
|
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
|
2013-10-21 13:49:51 -05:00
|
|
|
end
|
|
|
|
|
2013-10-22 15:30:30 -05:00
|
|
|
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
|
|
|
|
|
2013-10-21 13:49:51 -05:00
|
|
|
end
|