Skip to content

Commit

Permalink
added :unless keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
timcharper committed Jul 23, 2007
1 parent 63f314f commit d6505b4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/role_requirement_system.rb
Expand Up @@ -56,6 +56,11 @@ def user_authorized_for?(user, params = {}, binding = self.binding)
next unless ( String===options[:if] ? eval(options[:if], binding) : options[:if].call(params) )
end

if options.has_key?(:unless)
# execute the proc. if the procedure returns true, we don't need to authenticate these roles
next if ( String===options[:unless] ? eval(options[:unless], binding) : options[:unless].call(params) )
end

# check to see if they have one of the required roles
passed = false
roles.each{|role|
Expand Down

0 comments on commit d6505b4

Please sign in to comment.