Module: Doorman::ClassMethods
- Defined in:
- lib/rails_doorman.rb
Instance Method Summary collapse
- #_add_acl(type, args, block) ⇒ Object
- #_clear_acl_list ⇒ Object
- #_doorman_default ⇒ Object
- #_doorman_list ⇒ Object
- #allow(*args, &block) ⇒ Object
- #deny(*args, &block) ⇒ Object
Instance Method Details
#_add_acl(type, args, block) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/rails_doorman.rb', line 53 def _add_acl(type, args, block) opts = args.is_a?(Array) ? args.first : args if opts == :all @_doorman_default = type return true end if block _doorman_list << Rule.from_block(type, opts, &block) else _doorman_list << Rule.from_hash(type, opts) end end |
#_clear_acl_list ⇒ Object
49 50 51 |
# File 'lib/rails_doorman.rb', line 49 def _clear_acl_list @_doorman_list = nil end |
#_doorman_default ⇒ Object
37 38 39 |
# File 'lib/rails_doorman.rb', line 37 def _doorman_default @_doorman_default ||= :allow end |
#_doorman_list ⇒ Object
33 34 35 |
# File 'lib/rails_doorman.rb', line 33 def _doorman_list @_doorman_list ||= [] end |
#allow(*args, &block) ⇒ Object
45 46 47 |
# File 'lib/rails_doorman.rb', line 45 def allow(*args, &block) _add_acl(:allow, args, block) end |
#deny(*args, &block) ⇒ Object
41 42 43 |
# File 'lib/rails_doorman.rb', line 41 def deny(*args, &block) _add_acl(:deny, args, block) end |