Method: ActiveDirectory::Group#member_groups

Defined in:
lib/bsb_active_directory/group.rb

#member_groups(recursive = false) ⇒ Object

Returns an array of all Group objects that belong to this group.

If the recursive argument is passed as false, then only Groups that belong explicitly to this Group are returned.

If the recursive argument is passed as true, then all Groups that belong to this Group, or any of its subgroups, are returned.



142
143
144
145
146
147
148
149
150
# File 'lib/bsb_active_directory/group.rb', line 142

def member_groups(recursive = false)
  @member_groups ||= Group.find(:all, distinguishedname: @entry[:member]).delete_if(&:nil?)
  if recursive
    member_groups.each do |group|
      @member_groups.concat(group.member_groups(true))
    end
  end
  @member_groups
end