Module: ActiveDirectory::Member

Included in:
Group, User
Defined in:
lib/active_directory/member.rb

Instance Method Summary collapse

Instance Method Details

#join(group) ⇒ Object

Add the member to the passed Group object. Returns true if this object is already a member of the Group, or if the operation to add it succeeded.



41
42
43
44
# File 'lib/active_directory/member.rb', line 41

def join(group)
	return false unless group.is_a?(Group)
	group.add(self)
end

#member_of?(usergroup) ⇒ Boolean

Returns true if this member (User or Group) is a member of the passed Group object.

Returns:

  • (Boolean)


30
31
32
33
34
35
# File 'lib/active_directory/member.rb', line 30

def member_of?(usergroup)
	group_dns = memberOf
	return false if group_dns.nil? || group_dns.empty?
	#group_dns = [group_dns] unless group_dns.is_a?(Array)
	group_dns.include?(usergroup.dn)
end

#unjoin(group) ⇒ Object

Remove the member from the passed Group object. Returns true if this object is not a member of the Group, or if the operation to remove it succeeded.



51
52
53
54
# File 'lib/active_directory/member.rb', line 51

def unjoin(group)
	return false unless group.is_a?(Group)
	group.remove(self)
end