Class: SimpleNavigationAcl::Base
- Inherits:
-
Object
- Object
- SimpleNavigationAcl::Base
- Defined in:
- lib/simple_navigation_acl/base.rb
Class Attribute Summary collapse
-
.contexts ⇒ Object
Returns the value of attribute contexts.
-
.current_user_method ⇒ Object
Returns the value of attribute current_user_method.
-
.entity ⇒ Object
Returns the value of attribute entity.
-
.verify_method ⇒ Object
Returns the value of attribute verify_method.
Class Method Summary collapse
- .apply_acl(navigation, id, context) ⇒ Object
- .filter_simple_navigation_with_rules!(simple_navigation_item_container, keys) ⇒ Object
- .navigations(obj_caller = nil, navigation_context = nil) ⇒ Object
Class Attribute Details
.contexts ⇒ Object
Returns the value of attribute contexts.
13 14 15 |
# File 'lib/simple_navigation_acl/base.rb', line 13 def contexts @contexts end |
.current_user_method ⇒ Object
Returns the value of attribute current_user_method.
11 12 13 |
# File 'lib/simple_navigation_acl/base.rb', line 11 def current_user_method @current_user_method end |
.entity ⇒ Object
Returns the value of attribute entity.
11 12 13 |
# File 'lib/simple_navigation_acl/base.rb', line 11 def entity @entity end |
.verify_method ⇒ Object
Returns the value of attribute verify_method.
11 12 13 |
# File 'lib/simple_navigation_acl/base.rb', line 11 def verify_method @verify_method end |
Class Method Details
.apply_acl(navigation, id, context) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/simple_navigation_acl/base.rb', line 36 def apply_acl(, id, context) context=:default if context.nil? rules_keys = ::AclRule.where(id: id, context: context).pluck(:key) container = .is_a?(::Configuration) ? .instance_variable_get(:@primary_navigation) : (container, rules_keys) true end |
.filter_simple_navigation_with_rules!(simple_navigation_item_container, keys) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/simple_navigation_acl/base.rb', line 44 def (, keys) .items.delete_if do || if keys.include?(.key.to_s) = . (, keys) if false else true end end end |
.navigations(obj_caller = nil, navigation_context = nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/simple_navigation_acl/base.rb', line 21 def (obj_caller=nil, =nil) = {} contexts = if .nil? ::Base.contexts else .is_a?(Array) ? : [] end contexts.each do |context| ::Helpers.load_config({context: context}, obj_caller) = .config. [context] = get_nav_items(, context) end end |