lib/arrthorizer/rails/controller_action.rb in arrthorizer-0.1.1 vs lib/arrthorizer/rails/controller_action.rb in arrthorizer-0.1.2
- old
+ new
@@ -1,10 +1,11 @@
module Arrthorizer
module Rails
class ControllerAction
ControllerNotDefined = Class.new(Arrthorizer::ArrthorizerException)
ActionNotDefined = Class.new(Arrthorizer::ArrthorizerException)
+ ActionNotConfigured = Class.new(Arrthorizer::ArrthorizerException)
attr_accessor :privilege
attr_reader :controller_path, :action_name
def self.get_current(controller)
@@ -29,9 +30,11 @@
"#{controller.controller_path}##{controller.action_name}"
end
def self.fetch(key)
registry.fetch(key)
+ rescue Arrthorizer::Registry::NotFound
+ raise ActionNotConfigured, "No privileges granted for #{key}"
end
def self.register(controller_action)
registry.add(controller_action)
end