require File.dirname(__FILE__) + '/lib/authorization'

ActionController::Base.send( :include, Authorization::Base )
ActionView::Base.send( :include, Authorization::Base::ControllerInstanceMethods )

# You can perform authorization at varying degrees of complexity.
# Choose a style of authorization below (see README) and the appropriate
# mixin will be used for your app.

# When used with the auth_test app, we define this in config/environment.rb
# AUTHORIZATION_MIXIN = "hardwired"
if not Object.constants.include? "AUTHORIZATION_MIXIN"
  AUTHORIZATION_MIXIN = "object roles"
end

case AUTHORIZATION_MIXIN
  when "hardwired"
    require File.dirname(__FILE__) + '/lib/hardwired_roles'
    ActiveRecord::Base.send( :include, 
      Authorization::HardwiredRoles::UserExtensions, 
      Authorization::HardwiredRoles::ModelExtensions 
    )
  when "simple roles"
    require File.dirname(__FILE__) + '/lib/simple_roles_table'
    require File.dirname(__FILE__) + '/lib/role.rb'
    ActiveRecord::Base.send( :include, 
      Authorization::SimpleRolesTable::UserExtensions, 
      Authorization::SimpleRolesTable::ModelExtensions 
    )
  when "object roles"
    require File.dirname(__FILE__) + '/lib/object_roles_table'
    ActiveRecord::Base.send( :include, 
      Authorization::ObjectRolesTable::UserExtensions, 
      Authorization::ObjectRolesTable::ModelExtensions
    )
end

require File.dirname(__FILE__) + '/lib/authorization'

ActionController::Base.send( :include, Authorization::Base )
ActionView::Base.send( :include, Authorization::Base::ControllerInstanceMethods )

# You can perform authorization at varying degrees of complexity.
# Choose a style of authorization below (see README) and the appropriate
# mixin will be used for your app.

# When used with the auth_test app, we define this in config/environment.rb
# AUTHORIZATION_MIXIN = "hardwired"
if not Object.constants.include? "AUTHORIZATION_MIXIN"
  AUTHORIZATION_MIXIN = "object roles"
end

case AUTHORIZATION_MIXIN
  when "hardwired"
    require File.dirname(__FILE__) + '/lib/hardwired_roles'
    ActiveRecord::Base.send( :include, 
      Authorization::HardwiredRoles::UserExtensions, 
      Authorization::HardwiredRoles::ModelExtensions 
    )
  when "simple roles"
    require File.dirname(__FILE__) + '/lib/simple_roles_table'
    require File.dirname(__FILE__) + '/lib/role.rb'
    ActiveRecord::Base.send( :include, 
      Authorization::SimpleRolesTable::UserExtensions, 
      Authorization::SimpleRolesTable::ModelExtensions 
    )
  when "object roles"
    require File.dirname(__FILE__) + '/lib/object_roles_table'
    require File.dirname(__FILE__) + '/lib/role.rb'
    ActiveRecord::Base.send( :include, 
      Authorization::ObjectRolesTable::UserExtensions, 
      Authorization::ObjectRolesTable::ModelExtensions
    )
end

Make sure role.rb is required.
Make sure role.rb is required.

git-svn-id: 02c4f2b41924253e56e2511452a55f2dbba1b96a@62 ab2ce248-d915-0410-80fa-b7cb84e05f00
