Method: JSS::LDAPServer#find_group

Defined in:
lib/jss/api_object/ldap_server.rb

#find_group(group, exact = false) ⇒ Array<Hash>

Returns The groupname and uid for all groups matching the query.

Parameters:

  • group (String)

    the group name to search for

  • exact (Boolean) (defaults to: false)

    if true, force an exact match, otherwuse use wildcards

Returns:

  • (Array<Hash>)

    The groupname and uid for all groups matching the query

Raises:



315
316
317
318
319
# File 'lib/jss/api_object/ldap_server.rb', line 315

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/#{CGI.escape group.to_s}")[:ldap_groups]
  exact ? raw.select { |u| u[:groupname] == group } : raw
end