lib/jss/api_object/ldap_server.rb in ruby-jss-1.1.0b5 vs lib/jss/api_object/ldap_server.rb in ruby-jss-1.1.3
- old
+ new
@@ -157,11 +157,11 @@
# @return [Boolean] is the user a member of the group?
#
def self.check_membership(ldap_server, user, group, api: JSS.api)
ldap_server_id = valid_id ldap_server
raise JSS::NoSuchItemError, "No LDAPServer matching #{ldap_server}" unless ldap_server_id
- rsrc = "#{RSRC_BASE}/id/#{ldap_server_id}/group/#{CGI.escape group}/user/#{CGI.escape user}"
+ rsrc = "#{RSRC_BASE}/id/#{ldap_server_id}/group/#{CGI.escape group.to_s}/user/#{CGI.escape user.to_s}"
member_check = api.get_rsrc rsrc
return false if member_check[:ldap_users].empty?
true
end
@@ -300,11 +300,11 @@
#
# @return [Array<Hash>] The mapped LDAP data for all usernames matching the query
#
def find_user(user, exact = false)
raise JSS::NoSuchItemError, 'LDAPServer not yet saved in the JSS' unless @in_jss
- raw = api.get_rsrc("#{RSRC_BASE}/id/#{@id}/user/#{user}")[:ldap_users]
+ raw = api.get_rsrc("#{RSRC_BASE}/id/#{@id}/user/#{CGI.escape user.to_s}")[:ldap_users]
exact ? raw.select { |u| u[:username] == user } : raw
end
# @param group[String] the group name to search for
#
@@ -312,10 +312,10 @@
#
# @return [Array<Hash>] The groupname and uid for all groups matching the query
#
def find_group(group, exact = false)
raise JSS::NoSuchItemError, 'LDAPServer not yet saved in the JSS' unless @in_jss
- raw = api.get_rsrc("#{RSRC_BASE}/id/#{@id}/group/#{group}")[:ldap_groups]
+ raw = api.get_rsrc("#{RSRC_BASE}/id/#{@id}/group/#{CGI.escape group.to_s}")[:ldap_groups]
exact ? raw.select { |u| u[:groupname] == group } : raw
end
# @param user[String] the username to check for memebership in the group
#