Sha256: a068c67d30a237e4b54df7a7425aaa52e5ba0a3d611410d2b538a9297680ad8e

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

# Include
require 'rubygems'
require 'active_support'
require 'role_based_security/model_additions'
require 'role_based_security/controller_additions'
require 'role_based_security/view_additions'

# = RoleBasedSecurity
#
module RoleBasedSecurity
  # ::Rails.logger.error("...")

  # default options that can be overridden on the global level
  @@options = {
      :home_path                => '/welcome',                                                    #
      :locale_message_key       => 'labels.invalid_rights',                                       #
      :invalid_rights_message   => 'Sorry, but you don\'t have access rights to visit this URL',  #
  }
  mattr_reader :options


  def self.enable_activerecord
    ActiveRecord::Base.send :include, RoleBasedSecurity::ModelAdditions
  end

  def self.enable_actionpack
    ActionController::Base.send :include, RoleBasedSecurity::ControllerAdditions
    ActionController::Base.send :extend, RoleBasedSecurity::ControllerAdditions::ClassMethods

    ActionView::Base.send :include, RoleBasedSecurity::ViewAdditions
  end
end

if defined? Rails
  RoleBasedSecurity.enable_activerecord if defined? ActiveRecord
  RoleBasedSecurity.enable_actionpack if defined? ActionController
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
role_based_security-0.5.0 lib/role_based_security.rb