diff --git a/lib/active_directory/user.rb b/lib/active_directory/user.rb index 6fcd6e7..51c1297 100644 --- a/lib/active_directory/user.rb +++ b/lib/active_directory/user.rb @@ -79,6 +79,14 @@ def groups @groups ||= Group.find(:all, :distinguishedname => @entry[:memberOf] ) end + # + # Returns true if User object is member of Group object. + # group is a dn of a group + # + def memberof? + self["memberof"].map(&:dn).include?(group) + end + # # Returns an array of User objects that have this # User as their manager.