Skip to content

Commit e4242e5

Browse files
committed
Expose Group.group? for testing if entry is group
1 parent cad70be commit e4242e5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/github/ldap/group.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,19 @@ def member_names
6969
end
7070
end
7171

72+
# Internal: Returns true if the object class(es) provided match a group's.
73+
def group?(object_class)
74+
self.class.group?(object_class)
75+
end
76+
7277
# Internal - Check if an object class includes the member names
7378
# Use `&` rathen than `include?` because both are arrays.
7479
#
7580
# NOTE: object classes are downcased by default in Net::LDAP, so this
7681
# will fail to match correctly unless we also downcase our group classes.
7782
#
7883
# Returns true if the object class includes one of the group class names.
79-
def group?(object_class)
84+
def self.group?(object_class)
8085
!(GROUP_CLASS_NAMES.map(&:downcase) & object_class.map(&:downcase)).empty?
8186
end
8287

0 commit comments

Comments
 (0)