Skip to content

Commit

Permalink
trying out proxy test page
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Mar 29, 2013
1 parent 891a1d3 commit 39a8396
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ApplicationController < ActionController::Base
##authorize! :discontinue, @product
## ----------------------------------


#check_authorization :unless => :devise_controller?
#load_and_authorize_resource :unless => :devise_controller?
rescue_from CanCan::AccessDenied do |exception|
Expand Down
31 changes: 31 additions & 0 deletions app/controllers/proxy_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class ProxyController < ApplicationController

skip_before_filter :authenticate_user!
skip_authorization_check :only => [:default]
skip_authorize_resource :only => [:default]
skip_load_resource :only => [:default]

def default
http_proxy = 'http://wproxy.qut.edu.au:3128/'# BawSite::Application.config.custom_proxy

conn = Faraday.new(:url => params[:url]) do |faraday|
faraday.request :url_encoded # form-encode POST params
faraday.response :logger # log requests to STDOUT
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
faraday.proxy http_proxy
end

response = conn.get

result = ""
result += response.status.to_s
result += "\n <pre>"
result += (response.headers).to_yaml
result += "\n </pre>"
result += "\n <hr/>"
result += response.body

render text: result
end

end
2 changes: 2 additions & 0 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def initialize(user)
# The first one is the action you're setting the permission for, the second one
# is the class of object you're setting it on.

# public actions ?



user ||= User.new # guest user (not logged in)
Expand Down

0 comments on commit 39a8396

Please sign in to comment.