Module: SimpleAccessControl::ClassMethods
- Defined in:
- lib/simple_access_control.rb
Instance Method Summary collapse
-
#access_control(ruleset = {}) ⇒ Object
Support for acl_system2 migration.
-
#access_rule(rule, filter_options = {}) ⇒ Object
This is the core of the filtering system and it couldn’t be simpler: access_rule ‘(admin || moderator)’, :only => [:edit, :update].
Instance Method Details
#access_control(ruleset = {}) ⇒ Object
Support for acl_system2 migration
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/simple_access_control.rb', line 38 def access_control(ruleset = {}) ruleset.each do |actions, rule| case actions when :DEFAULT access_rule rule when Array, Symbol, String access_rule rule, :only => actions end end end |
#access_rule(rule, filter_options = {}) ⇒ Object
This is the core of the filtering system and it couldn’t be simpler:
access_rule '(admin || moderator)', :only => [:edit, :update]
51 52 53 |
# File 'lib/simple_access_control.rb', line 51 def access_rule(rule, = {}) before_filter (||{}) { |c| c.send :permission_required, rule } end |