Sha256: 1ea39b777133516fb14ce9977c4887a365a3709a4a993431c937a2f799e9af99

Contents?: true

Size: 680 Bytes

Versions: 7

Compression:

Stored size: 680 Bytes

Contents

Walruz.setup do |config|
  
  #
  # Specify which models behave like Actors in your authorization system
  config.actors = [Beatle, Colaboration]
  
  # Specify which models behave like Subjects (default: All of them)
  config.subjects = [ActiveRecord::Base]
  
  ActionController::Base.class_eval do
    
    rescue_from Walruz::NotAuthorized, :with => 'unathorized'
    
    #
    # This method will be called when a user is not authorized. By
    # default it renders a unauthorized template on the public directory
    # with a HTTP status 401 (not authorized)
    def unauthorized(e)
      render :template => 'public/unauthorized.html', :status => 401
    end
    
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
walruz-rails-0.0.11 examples/rails/config/initializers/walruz_initializer.rb
walruz-rails-0.0.10 examples/rails/config/initializers/walruz_initializer.rb
walruz-rails-0.0.9 examples/rails/config/initializers/walruz_initializer.rb
walruz-rails-0.0.8 examples/rails/config/initializers/walruz_initializer.rb
walruz-rails-0.0.3 examples/rails/config/initializers/walruz_initializer.rb
walruz-rails-0.0.4 examples/rails/config/initializers/walruz_initializer.rb
walruz-rails-0.0.5 examples/rails/config/initializers/walruz_initializer.rb