Skip to content
Browse files

application controllers must now include Aegis::Controller to be safe…

… from load order issues
  • Loading branch information...
1 parent ee3d495 commit 5b25463a9cc29169246f0c1a93f306cc5ea40aee @henning-koch henning-koch committed Sep 3, 2010
View
1 Rakefile
@@ -29,6 +29,7 @@ begin
gemspec.homepage = "http://github.com/makandra/aegis"
gemspec.description = "Aegis is an authorization solution for Ruby on Rails that supports roles and a RESTish, resource-style declaration of permission rules."
gemspec.authors = ["Henning Koch", "Tobias Kraze"]
+ gemspec.post_install_message = "Upgrade notice:\nIf you are using Aegis' automatic controller integration, include Aegis::Controller in your ApplicationController\nAlso see http://wiki.github.com/makandra/aegis/controller-integration\n"
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
View
0 lib/rails/active_record.rb → lib/aegis/active_record_ext.rb
File renamed without changes.
View
11 lib/rails/action_controller.rb → lib/aegis/controller.rb
@@ -1,5 +1,10 @@
module Aegis
- module ActionController
+ module Controller
+
+ def self.included(base)
+ base.send :include, InstanceMethods
+ base.send :extend, ClassMethods
+ end
module ClassMethods
@@ -67,7 +72,3 @@ def unchecked_permissions
end
end
-ActionController::Base.extend Aegis::ActionController::ClassMethods
-ActionController::Base.send :include, Aegis::ActionController::InstanceMethods
-
-
View
5 lib/aegis/loader.rb
@@ -14,9 +14,8 @@ def paths
'aegis/resource',
'aegis/role',
'aegis/sieve',
-
- 'rails/action_controller',
- 'rails/active_record' ]
+ 'aegis/controller',
+ 'aegis/active_record_ext' ]
end
def load_paths
View
3 spec/aegis/action_controller_spec.rb → spec/aegis/controller_spec.rb
@@ -1,6 +1,6 @@
require "spec_helper"
-describe Aegis::ActionController do
+describe Aegis::Controller do
before(:each) do
@@ -21,6 +21,7 @@
user = @user = @user_class.new(:role_name => 'user')
@controller_class = Class.new(ActionController::Base) do
+ include Aegis::Controller
define_method :current_user do
user
end
View
1 spec/aegis/spec/matchers_spec.rb
@@ -38,6 +38,7 @@
before(:each) do
@controller = Class.new(ActionController::Base) do
+ include Aegis::Controller
permissions :post
end.new
end
View
1 spec/app_root/app/controllers/application_controller.rb
@@ -1,4 +1,5 @@
class ApplicationController < ActionController::Base
+ include Aegis::Controller
require_permissions

0 comments on commit 5b25463

Please sign in to comment.
Something went wrong with that request. Please try again.