Skip to content

Expose Group.group? for testing if entry is a group #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/github/ldap/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,19 @@ def member_names
end
end

# Internal: Returns true if the object class(es) provided match a group's.
def group?(object_class)
self.class.group?(object_class)
end

# Internal - Check if an object class includes the member names
# Use `&` rathen than `include?` because both are arrays.
#
# NOTE: object classes are downcased by default in Net::LDAP, so this
# will fail to match correctly unless we also downcase our group classes.
#
# Returns true if the object class includes one of the group class names.
def group?(object_class)
def self.group?(object_class)
!(GROUP_CLASS_NAMES.map(&:downcase) & object_class.map(&:downcase)).empty?
end

Expand Down