Module: Clearance::Authorization

Extended by:
ActiveSupport::Concern
Included in:
Controller
Defined in:
lib/clearance/authorization.rb

Instance Method Summary collapse

Instance Method Details

#authorizeObject



9
10
11
12
13
# File 'lib/clearance/authorization.rb', line 9

def authorize
  unless signed_in?
    deny_access
  end
end

#deny_access(flash_message = nil) ⇒ Object



15
16
17
18
19
20
# File 'lib/clearance/authorization.rb', line 15

def deny_access(flash_message = nil)
  respond_to do |format|
    format.any(:js, :json, :xml) { head :unauthorized }
    format.any { redirect_request(flash_message) }
  end
end