Sha256: 353395f90d5cc9f02f199c4f43c668bd37581e6c1beb5b7259eb673f96488b40
Contents?: true
Size: 712 Bytes
Versions: 10
Compression:
Stored size: 712 Bytes
Contents
module RoleAuthorization module Rules class Rule attr_accessor :role, :options attr_accessor :returning # for calls to authorized? attr_accessor :controller_instance, :controller, :action, :id def initialize(role, options, &block) @returning = block @role = role @options = options self end def authorized?(*args) @controller_instance, @controller, @action, @id = args if instance_eval(&returning) true else # need to run an on_fail proc? controller_instance.instance_eval(&options[:on_fail]) if options[:on_fail] false end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems