Module: ActiveAcl::Acts::AccessGroup::ClassMethods

Defined in:
lib/active_acl/acts_as_access_group.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_access_group(options = {}) ⇒ Object

Extend self with access group capabilites. Options can be:

type

is mandatory and is one of the group handler classes

left_column

for ActiveAcl::Acts::AccessGroup::NestedSet grouped objects

right_column

for ActiveAcl::Acts::AccessGroup::NestedSet grouped objects



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/active_acl/acts_as_access_group.rb', line 18

def acts_as_access_group(options = {})
  type=options.delete(:type) || ActiveAcl::Acts::AccessGroup::NestedSet
  ActiveAcl::GROUP_CLASSES[self.name] = type.new(options)

  include ActiveAcl::Acts::Grant
  include InstanceMethods
  extend SingletonMethods                         
  
  ActiveAcl::Acl.instance_eval do
    has_many_polymorphs :requester_groups, {:from => ActiveAcl.from_classes, 
      :through => :"active_acl/requester_group_links",
      :rename_individual_collections => true}
    
    has_many_polymorphs :target_groups, {:from => ActiveAcl.from_classes, 
      :through => :"active_acl/target_group_links",
      :rename_individual_collections => true}
  end
  
end