Module: Fortress::Controller

Extended by:
ActiveSupport::Concern
Defined in:
lib/fortress/controller.rb

Overview

The Controller module embbed all the code to “hook” Fortress to your Rails application.

Author:

  • zedtux

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#access_denyObject

Default access_deny method used when not re-defined in the Rails application.

You can re-define it within the ApplicationController of you rails application.



31
32
33
34
35
36
37
# File 'lib/fortress/controller.rb', line 31

def access_deny
  respond_to do |format|
    format.html { redirect_to_root_url_with_flash_message }
    format.json { unauthorized_with_error_message(:json) }
    format.xml { unauthorized_with_error_message(:xml) }
  end
end

#prevent_access!Object



20
21
22
23
# File 'lib/fortress/controller.rb', line 20

def prevent_access!
  controller = Fortress::ControllerInterface.new(self)
  Mechanism.authorised?(controller, action_name) ? true : access_deny
end