Skip to content

Commit

Permalink
automatically include modules
Browse files Browse the repository at this point in the history
  • Loading branch information
timcharper committed Jul 23, 2007
1 parent 531844e commit 1449451
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion init.rb
Expand Up @@ -4,4 +4,8 @@
if RAILS_ENV=="test"
require "role_requirement_test_helper.rb"
require "hijacker.rb"
end
Test::Unit::TestCase.send :include, RoleRequirementTestHelper
end

ActionController::Base.send :include, AuthenticatedSystem
ActionController::Base.send :include, RoleRequirement
7 changes: 4 additions & 3 deletions lib/role_requirement_system.rb
Expand Up @@ -82,9 +82,10 @@ def user_authorized_for?(user, params = {}, binding = self.binding)

# check to see if they have one of the required roles
passed = false
roles.each{|role|
passed = true if user && user.has_role?(role)
}
roles.each { |role|
passed = true if user.has_role?(role)
} unless (user==:false || user==false)

return false unless passed
}

Expand Down

0 comments on commit 1449451

Please sign in to comment.