lib/authority/authorizer.rb in authority-1.1.0 vs lib/authority/authorizer.rb in authority-2.0.0
- old
+ new
@@ -21,20 +21,21 @@
self.class.#{adjective}_by?(user)
end
RUBY
end
- # Each class method simply calls the user-definable default strategy
+ # Each class method simply calls the `default` method
Authority.adjectives.each do |adjective|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def self.#{adjective}_by?(user)
default(:#{adjective}, user)
end
RUBY
end
+ # Whitelisting approach: anything not specified will be forbidden
def self.default(adjective, user)
- Authority.configuration.default_strategy.call(adjective, self, user)
+ false
end
end
class NoAuthorizerError < StandardError ; end