class Jamf::DirectoryBindingType::ActiveDirectory

Class for the specific Active Directory DirectoryBinding type stored within the JSS

@author Tyler Morgan

Attributes @!attribute [rw] cache_last_user @!attribute [rw] require_confirmation @!attribute [rw] local_home @!attribute [rw] use_unc_path @!attribute [rw] mount_style @!attribute [rw] default_shell @!attribute [rw] uid @!attribute [rw] user_gid @!attribute [rw] gid @!attribute [rw] multiple_domains @!attribute [rw] preferred_domain @!attribute [rw] admin_groups @!attribute [rw] forest TODO: Include default values upon creation

Attributes

admin_groups[R]
cache_last_user[R]

Attributes

default_shell[R]
forest[R]
gid[R]
local_home[R]
mount_style[R]
multiple_domains[R]
preferred_domain[R]
require_confirmation[R]
uid[R]
use_unc_path[R]
user_gid[R]

Public Class Methods

new(init_data) click to toggle source

An initializer for the Active Directory object.

@author Tyler Morgan @see Jamf::DirectoryBinding @see Jamf::DirectoryBindingType

@param [Hash] initialize data

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
 96 def initialize(init_data)
 97 
 98     # Return without processing anything since there is
 99     # nothing to process.
100     return if init_data.nil?
101 
102     # Process provided information
103     @cache_last_user = init_data[:cache_last_user]
104     @require_confirmation = init_data[:require_confirmation]
105     @local_home = init_data[:local_home]
106     @use_unc_path = init_data[:use_unc_path]
107     @default_shell = init_data[:default_shell]
108     @uid = init_data[:uid]
109     @user_gid = init_data[:user_gid]
110     @gid = init_data[:gid]
111     @multiple_domains = init_data[:multiple_domains]
112     @preferred_domain = init_data[:preferred_domain]
113     @forest = init_data[:forest]
114 
115     if init_data[:mount_style].nil? || init_data[:mount_style].is_a?(String)
116         raise Jamf::InvalidDataError, "Mount style must be one of #{NETWORK_PROTOCOL.values.join(', ')}." unless NETWORK_PROTOCOL.values.map { |x| x.downcase }.include?(init_data[:mount_style].downcase) || init_data[:mount_style].nil? 
117         @mount_style = init_data[:mount_style]
118     else
119         raise Jamf::InvalidDataError, "Mount style must be one of :#{NETWORK_PROTOCOL.keys.join(',:')}," unless NETWORK_PROTOCOL.keys.include? init_data[:mount_style]
120 
121         @mount_style = NETWORK_PROTOCOL[init_data[:mount_style]]
122     end
123 
124     if init_data[:admin_groups].nil?
125         # This is needed since we have the ability to add and
126         # remove admin groups from this array.
127         @admin_groups = []
128     elsif init_data[:admin_groups].is_a? String
129         @admin_groups = init_data[:admin_groups].split(',')
130     else
131         @admin_groups = init_data[:admin_groups]
132     end
133 end

Public Instance Methods

add_admin_group(value) click to toggle source

Add a specific admin group to the admin_groups

@author Tyler Morgan

@param newvalue [String] The admin group name you want to add to the admin group list

@raise [Jamf::InvalidDataError] If the value provided is not a String @raise [Jamf::InvalidDataError] If the group provided is not in the admin_group array

@return [Array <String>] An array of all the admin groups currently set.

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
477 def add_admin_group(value)
478 
479     raise Jamf::InvalidDataError, "Admin group must be a string." unless value.is_a? String
480     raise Jamf::InvalidDataError, "Group \"#{value}\" already is in the admin groups." unless !@admin_groups.include? value
481 
482     @admin_groups << value
483     # Set the object to needing to be updated.
484     self.container&.should_update
485 
486     return @admin_groups
487 end
admin_groups=(newvalue) click to toggle source

The AD group which can be considered administrators of a device.

@author Tyler Morgan

@param newvalue [Array <String>]

@raise [Jamf::InvalidDataError] If the provided value is not an Array.

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
444 def admin_groups=(newvalue)
445     new =
446         if newvalue.to_s.empty?
447             Jamf::BLANK
448         else
449             # Data Check
450             raise Jamf::InvalidDataError, "admin_groups must be either a string or an array of strings." unless (newvalue.is_a? String || newvalue.is_a?(Array))
451             
452             if newvalue.is_a? Array
453                 newvalue.join ","
454             else
455                 newvalue
456             end
457         end
458         
459     # Update Value
460     @admin_groups = new
461 
462     # Set the object to needing to be updated.
463     self.container&.should_update
464 end
cache_last_user=(newvalue) click to toggle source

Create mobile account upon login

@author Tyler Morgan

@param newvalue [Bool]

@raise [Jamf::InvalidDataError] If the new value doesn’t match a Bool value

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
149 def cache_last_user=(newvalue)
150 
151     # Data Check
152     raise Jamf::InvalidDataError, "cache_last_user must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a?(FalseClass)
153 
154     # Update Value
155     @cache_last_user = newvalue
156 
157     # Set the object to needing to be updated.
158     self.container&.should_update
159 end
default_shell=(newvalue) click to toggle source

The directory path to the shell user’s default shell will be set to upon login.

@author Tyler Morgan

@param newvalue [String] Directory path for the specific shell that is wanting to be set.

@raise [Jamf::InvalidDataError] If the new value is not a String

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
260 def default_shell=(newvalue)
261 
262     new =
263         if newvalue.to_s.empty?
264             Jamf::BLANK
265         else
266             # Data Check
267             raise Jamf::InvalidDataError, "default_shell must be a string." unless newvalue.is_a? String
268             newvalue
269         end
270 
271     # Update Value
272     @default_shell = new
273 
274     # Set the object to needing to be updated.
275     self.container&.should_update
276 end
forest=(newvalue) click to toggle source

Specify a specific forest within Active Directory

@author Tyler Morgan

@param newvalue [String] The forest you want to specify

@raise [Jamf::InvalidDataError] If the new value is not a String

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
315 def forest=(newvalue)
316     new =
317         if newvalue.to_s.empty?
318             Jamf::BLANK
319         else
320             # Data Check
321             raise Jamf::InvalidDataError, "forest must be a string." unless newvalue.is_a? String
322             newvalue
323         end
324     
325     # Update Value
326     @forest = new
327 
328     # Set the object to needing to be updated.
329     self.container&.should_update
330 end
gid=(newvalue) click to toggle source

Map specific a GID to Attribute

@author Tyler Morgan

@param newvalue [String] The GID you want to be mapped

@raise [Jamf::InvalidDataError] If the new value is not a String

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
368 def gid=(newvalue)
369     new =
370         if newvalue.to_s.empty?
371             Jamf::BLANK
372         else
373             # Data Check
374             raise Jamf::InvalidDataError, "gid must be either an integer or a string." unless (newvalue.is_a? Integer || newvalue.is_a?(String))
375             newvalue
376         end
377     
378     # Update Value
379     @gid = new
380 
381     # Set the object to needing to be updated.
382     self.container&.should_update
383 end
local_home=(newvalue) click to toggle source

Force local home directory to be placed on the startup disk

@author Tyler Morgan

@param newvalue [Bool]

@raise [Jamf::InvalidDataError] If the new value doesn’t match a Bool value

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
193 def local_home=(newvalue)
194 
195     # Data Check
196     raise Jamf::InvalidDataError, "local_home must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a?(FalseClass)
197 
198     # Update Value
199     @local_home = newvalue
200 
201     # Set the object to needing to be updated.
202     self.container&.should_update
203 end
mount_style=(newvalue) click to toggle source

The protocol to be use when mounting network home location

@author Tyler Morgan

@param newvalue [Symbol] One of the keys available in NETWORK_PROTOCOL @see Jamf::DIRECTORYBINDINGTYPE::NETWORK_PROTOCOL

@raise [Jamf::InvalidDataError] If the new value provided is not a key inside the NETWORK_PROTOCOL hash.

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
238 def mount_style=(newvalue)
239 
240     # Data Check
241     raise Jamf::InvalidDataError, "mount_style must be one of :#{NETWORK_PROTOCOL.keys.join(',:')}." unless NETWORK_PROTOCOL.keys.include? newvalue
242 
243     # Update Value
244     @mount_style = newvalue
245 
246     # Set the object to needing to be updated.
247     self.container&.should_update
248 end
multiple_domains=(newvalue) click to toggle source

Will this computer be possibly connecting to multiple domains

@author Tyler Morgan

@param newvalue [Bool]

@raise [Jamf::InvalidDataError] If the provided value is not a Bool.

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
395 def multiple_domains=(newvalue)
396 
397     # Data Check
398     raise Jamf::InvalidDataError, "multiple_domains must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a?(FalseClass)
399 
400     # Update Value
401     @multiple_domains = newvalue
402 
403     # Set the object to needing to be updated.
404     self.container&.should_update
405 end
preferred_domain=(newvalue) click to toggle source

What domain server should be highest priority

@author Tyler Morgan

@param newvalue [String]

@raise [Jamf::InvalidDataError] If the provided value is not a String.

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
417 def preferred_domain=(newvalue)
418     new =
419         if newvalue.to_s.empty?
420             Jamf::BLANK
421         else
422             # Data Check
423             raise Jamf::InvalidDataError, "preferred_domain must be a string." unless newvalue.is_a? String
424             newvalue
425         end
426 
427     # Update Value
428     @preferred_domain = new
429 
430     # Set the object to needing to be updated.
431     self.container&.should_update
432 end
remove_admin_group(value) click to toggle source

Remove a specific admin group from the admin_groups

@author Tyler Morgan

@param newvalue [String] The admin group name you want to remove from the admin groups.

@raise [Jamf::InvalidDataError] If the value provided is not a String @raise [Jamf::InvalidDataError] If the group provided is not in the admin_group array

@return [Array <String>] An array of all the admin groups currently set.

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
500 def remove_admin_group(value)
501 
502     raise Jamf::InvalidDataError, "Admin group being removed must be a string." unless value.is_a? String
503     raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_groups.include? value
504 
505     @admin_groups.delete value
506     # Set the object to needing to be updated.
507     self.container&.should_update
508 
509     return @admin_groups
510 end
require_confirmation=(newvalue) click to toggle source

Require confirmation before creating a mobile account on the system.

@author Tyler Morgan

@param newvalue [Bool]

@raise [Jamf::InvalidDataError] If the new value doesn’t match a Bool value

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
171 def require_confirmation=(newvalue)
172 
173     # Data Check
174     raise Jamf::InvalidDataError, "require_confirmation must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a?(FalseClass)
175 
176     # Update Value
177     @require_confirmation = newvalue
178 
179     # Set the object to needing to be updated.
180     self.container&.should_update
181 end
type_setting_xml() click to toggle source

Return a REXML Element containing the current state of the DirectoryBindingType object for adding into the XML of the container.

@author Tyler Morgan

@return [REXML::Element]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
519 def type_setting_xml
520     type_setting = REXML::Element.new "active_directory"
521     type_setting.add_element("cache_last_user").text = @cache_last_user
522     type_setting.add_element("require_confirmation").text = @require_confirmation
523     type_setting.add_element("local_home").text = @local_home
524     type_setting.add_element("use_unc_path").text = @use_unc_path
525     type_setting.add_element("mount_style").text = @mount_style.downcase
526     type_setting.add_element("default_shell").text = @default_shell
527     type_setting.add_element("uid").text = @uid
528     type_setting.add_element("user_gid").text = @user_gid
529     type_setting.add_element("gid").text = @gid
530     type_setting.add_element("multiple_domains").text = @multiple_domains
531     type_setting.add_element("preferred_domain").text = @preferred_domain
532     type_setting.add_element("admin_groups").text = @admin_groups.join(',').to_s unless @admin_groups.nil?
533     type_setting.add_element("forest").text = @forest.to_s
534 
535     return type_setting
536 end
uid=(newvalue) click to toggle source

Map specific a UID to Attribute

@author Tyler Morgan

@param newvalue [String] The UID you want to be mapped

@raise [Jamf::InvalidDataError] If the new value is not a String

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
288 def uid=(newvalue)
289     new =
290         if newvalue.to_s.empty?
291             Jamf::BLANK
292         else
293             # Data Check
294             raise Jamf::InvalidDataError, "uid must be either an integer or a string." unless (newvalue.is_a? Integer || newvalue.is_a?(String))
295             newvalue
296         end
297 
298     # Update Value
299     @uid = new
300 
301     # Set the object to needing to be updated.
302     self.container&.should_update
303 end
use_unc_path=(newvalue) click to toggle source

Attempt to derive the network home location using the UNC path stored inside Active Directory

@author Tyler Morgan

@param newvalue [Bool]

@raise [Jamf::InvalidDataError] If the new value doesn’t match a Bool value

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
215 def use_unc_path=(newvalue)
216 
217     # Data Check
218     raise Jamf::InvalidDataError, "use_unc_path must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a?(FalseClass)
219 
220     # Update Value
221     @use_unc_path = newvalue
222 
223     # Set the object to needing to be updated.
224     self.container&.should_update
225 end
user_gid=(newvalue) click to toggle source

Map specific a User’s GID to Attribute

@author Tyler Morgan

@param newvalue [String] The User’s GID you want to be mapped

@raise [Jamf::InvalidDataError] If the new value is not a String

@return [void]

    # File lib/jamf/api/classic/api_objects/directory_binding_type/active_directory.rb
341 def user_gid=(newvalue)
342     new =
343         if newvalue.to_s.empty?
344             Jamf::BLANK
345         else
346             # Data Check
347             raise Jamf::InvalidDataError, "user_gid must be either an integer or a string." unless (newvalue.is_a? Integer || newvalue.is_a?(String))
348             newvalue
349         end
350 
351     # Update Value
352     @user_gid = new
353 
354     # Set the object to needing to be updated.
355     self.container&.should_update
356 end