IPN improvements

This commit is contained in:
2013-08-28 03:18:47 -07:00
parent 0be2834a5d
commit c662be6dc0
10 changed files with 48 additions and 15 deletions

View File

@@ -24,6 +24,16 @@ class IpnsController < ApplicationController
#end
end
def import
@ipn = Ipn.new_from_dynamic_params(params)
@ipn.data = params.to_json
@ipn.save
redirect_to ipn_path(@ipn)
#unless @ipn.validate!
# Rails.logger.error "Unable to validate IPN: #{@ipn.inspect}"
#end
end
def validate
if @ipn.validate!
redirect_to ipns_url, :notice => 'Valid!'

View File

@@ -1,5 +1,15 @@
class MacsController < ApplicationController
load_and_authorize_resource :mac, :except => [:index, :scan, :import]
rescue_from CanCan::AccessDenied do |exception|
today = Date.today
event = Date.new(2013,9,1)
if today == event
redirect_to main_app.root_url, :alert => "CryptoParty today; no MAC scanning. Sorry, NSA!"
else
redirect_to main_app.root_url, :alert => "Nothing to see here!"
end
end
load_and_authorize_resource :mac
load_and_authorize_resource :user, :through => :mac, :except => [:index, :show, :scan, :import]
#require "active_record"

View File

@@ -69,7 +69,7 @@ class UsersController < ApplicationController
def create
respond_to do |format|
if @user.save
format.html { redirect_to users_url, :notice => 'User was successfully created.' }
format.html { redirect_to @user, :notice => 'User was successfully created.' }
format.json { render :json => @user, :status => :created, :location => @user }
else
format.html { render :action => "new" }
@@ -83,7 +83,7 @@ class UsersController < ApplicationController
def update
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to users_url, :notice => 'User was successfully updated.' }
format.html { redirect_to @user, :notice => 'User was successfully updated.' }
format.json { head :no_content }
else
format.html { render :action => "edit" }