Method: JSS::User#add_site

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

#add_site(site) ⇒ void

This method returns an undefined value.

Add this user to a site

Parameters:

  • site (String)

    the name of the site

Raises:



232
233
234
235
236
237
# File 'lib/jss/api_object/user.rb', line 232

def add_site (site)
  return nil if @sites.map{|s| s[:name]}.include? site
  raise JSS::InvalidDataError, "No site in the JSS named #{site}" unless JSS::Site.all_names(api: @api).include? site
  @sites << {:name => site}
  @need_to_update = true
end