class Jamf::DirectoryBindingType::ADmitMac
Class for the specific ADmitMac
DirectoryBinding
type stored within the JSS
@author Tyler Morgan
@note “Map Home Directory To Attribute” is currently only available in the Jamf
Pro UI not through the API.
Attributes @!attribute [rw] require_confirmation
@!attribute [rw] local_home
@!attribute [rw] mount_style
@!attribute [rw] default_shell
@!attribute [rw] mount_network_home
@!attribute [rw] place_home_folders
@!attribute [rw] uid @!attribute [rw] user_gid
@!attribute [rw] gid @!attribute [rw] admin_group
@!attribute [rw] cached_credentials
@!attribute [rw] add_user_to_local
@!attribute [rw] users_ou
@!attribute [rw] groups_ou
@!attribute [rw] printers_ou
@!attribute [rw] shared_folders_ou
TODO: Include default values upon creation
Attributes
Attributes
Public Class Methods
An initializer for the ADmitMac
object.
@author Tyler Morgan @see Jamf::DirectoryBinding
@see Jamf::DirectoryBindingType
@note Due to a JSS
API funk, mount_style
is not able to be configured through the API. It is linked to place_home_folders
@param [Hash] initialize data
# File lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb 108 def initialize(init_data) 109 # Return without processing anything since there is 110 # nothing to process. 111 return if init_data.nil? 112 113 # Process the provided information 114 @require_confirmation = init_data[:require_confirmation] 115 @default_shell = init_data[:default_shell] 116 @mount_network_home = init_data[:mount_network_home] 117 @place_home_folders = init_data[:place_home_folders] 118 @uid = init_data[:uid] 119 @user_gid = init_data[:user_gid] 120 @gid = init_data[:gid] 121 @cached_credentials = init_data[:cached_credentials] 122 @add_user_to_local = init_data[:add_user_to_local] 123 @users_ou = init_data[:users_ou] 124 @groups_ou = init_data[:groups_ou] 125 @printers_ou = init_data[:printers_ou] 126 @shared_folders_ou = init_data[:shared_folders_ou] 127 @mount_style = init_data[:mount_style] 128 129 if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) 130 unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? 131 raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." 132 end 133 134 @local_home = init_data[:local_home] 135 else 136 unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] 137 raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." 138 end 139 end 140 141 @admin_group = if init_data[:admin_group].nil? 142 # This is needed since we have the ability to add and 143 # remove admin groups from this array. 144 [] 145 elsif init_data[:admin_group].is_a? String 146 init_data[:admin_group].split(',') 147 else 148 init_data[:admin_group] 149 end 150 end
Public Instance Methods
An a specific admin group to admin_group
@author Tyler Morgan
@param value [String] The admin group name you wish 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 already a member of 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/admitmac.rb 530 def add_admin_group(value) 531 raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String 532 raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value 533 534 @admin_group << value 535 536 container&.should_update 537 538 @admin_group 539 end
If the user is a member of one of the groups in admin_group
, add them to the local administrator group.
@author Tyler Morgan @see admin_group
@param newvalue [Bool]
@raise [Jamf::InvalidDataError] If the new value is not a Bool
@return [void]
# File lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb 408 def add_user_to_local=(newvalue) 409 raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) 410 411 @add_user_to_local = newvalue 412 413 container&.should_update 414 end
Set specific groups to become administrators to a system.
@author Tyler Morgan
@param newvalue [Array<String>] An array of all the admin group names you want to set. @see add_admin_group
@see remove_admin_group
@raise [Jamf::InvalidDataError] If the new value is not an Array
@return [void]
# File lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb 354 def admin_group=(newvalue) 355 new = 356 if newvalue.to_s.empty? 357 Jamf::BLANK 358 else 359 # Data Check 360 unless newvalue.is_a? Array 361 raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' 362 end 363 364 newvalue 365 end 366 367 @admin_group = new 368 369 container&.should_update 370 end
The number of times a user can log into the device while not connected to a network
@author Tyler Morgan
@param newvalue [Integer] The number of times you want a user to login while not connected to a network
@raise [Jamf::InvalidDataError] If the new value is not an Integer
@return [void]
# File lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb 381 def cached_credentials=(newvalue) 382 new = 383 if newvalue.to_s.empty? 384 Jamf::BLANK 385 else 386 # Data Check 387 raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer 388 389 newvalue 390 end 391 392 @cached_credentials = new 393 394 container&.should_update 395 end
The default shell assigned first upon logging into a system
@author Tyler Morgan
@param newvalue [String] The string path of the shell file being set as the default
@raise [Jamf::InvalidDataError] If the new value is not a String
@return [void]
# File lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb 207 def default_shell=(newvalue) 208 new = 209 if newvalue.to_s.empty? 210 Jamf::BLANK 211 else 212 # Data Check 213 raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) 214 215 newvalue 216 end 217 218 @default_shell = new 219 220 container&.should_update 221 end
Map specific 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/admitmac.rb 327 def gid=(newvalue) 328 new = 329 if newvalue.to_s.empty? 330 Jamf::BLANK 331 else 332 # Data Check 333 raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? 334 335 newvalue 336 end 337 338 @gid = new 339 340 container&.should_update 341 end
An OU path for specific User
Groups
@author Tyler Morgan
@param newvalue [String] The OU path for the specific user group @note Not sure what this is used for
@raise [Jamf::InvalidDataError] If the new value is not a String
@return [void]
# File lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb 452 def groups_ou=(newvalue) 453 new = 454 if newvalue.to_s.empty? 455 Jamf::BLANK 456 else 457 # Data Check 458 raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? 459 460 newvalue 461 end 462 463 @groups_ou = new 464 465 container&.should_update 466 end
The type of home directory type created upon logging into a system
@author Tyler Morgan
@param newvalue [Symbol] The key specific to the folder type you want in HOME_FOLDER_TYPE @see Jamf::DirectoryBindingType::HOME_FOLDER_TYPE
@raise [Jamf::InvalidDataError] If the new value is not one of the possible keys in HOME_FOLDER_TYPE
@return [void]
# File lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb 182 def local_home=(newvalue) 183 new = 184 if newvalue.to_s.empty? 185 Jamf::BLANK 186 else 187 # Data Check 188 raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue 189 190 HOME_FOLDER_TYPE[newvalue] 191 end 192 193 @local_home = new 194 195 container&.should_update 196 end
Mount network home folder on desktop
@author Tyler Morgan
@param newvalue [Bool]
@raise [Jamf::InvalidDataError] If the new value is not a Bool
@return [void]
# File lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb 232 def mount_network_home=(newvalue) 233 raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) 234 235 @mount_network_home = newvalue 236 237 container&.should_update 238 end
Path at which home folders are placed
@author Tyler Morgan
@param newvalue [String] The string path of the folder which user’s directory files and folders will be created
@raise [Jamf::InvalidDataError] If the new value is not a String
@return [void]
# File lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb 249 def place_home_folders=(newvalue) 250 new = 251 if newvalue.to_s.empty? 252 Jamf::BLANK 253 else 254 # Data Check 255 raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String 256 257 newvalue 258 end 259 260 @place_home_folders = new 261 262 container&.should_update 263 end
An OU path for specific Printers
@author Tyler Morgan
@param newvalue [String] The OU path for the specific printer @note Not sure what this is used for
@raise [Jamf::InvalidDataError] If the new value is not a String
@return [void]
# File lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb 478 def printers_ou=(newvalue) 479 new = 480 if newvalue.to_s.empty? 481 Jamf::BLANK 482 else 483 # Data Check 484 raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? 485 486 newvalue 487 end 488 489 @printers_ou = new 490 491 container&.should_update 492 end
Remove a specific admin group to admin_group
@author Tyler Morgan
@param newvalue [String] The admin group name you wish to remove from 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/admitmac.rb 551 def remove_admin_group(value) 552 raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String 553 raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value 554 555 @admin_group.delete value 556 557 container&.should_update 558 559 @admin_group 560 end
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/admitmac.rb 164 def require_confirmation=(newvalue) 165 raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) 166 167 @require_confirmation = newvalue 168 169 container&.should_update 170 end
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/admitmac.rb 568 def type_setting_xml 569 type_setting = REXML::Element.new 'admitmac' 570 type_setting.add_element('require_confirmation').text = @require_confirmation 571 type_setting.add_element('local_home').text = @local_home 572 type_setting.add_element('mount_style').text = @mount_style.downcase 573 type_setting.add_element('default_shell').text = @default_shell 574 type_setting.add_element('mount_network_home').text = @mount_network_home 575 type_setting.add_element('place_home_folders').text = @place_home_folders 576 type_setting.add_element('uid').text = @uid 577 type_setting.add_element('user_gid').text = @user_gid 578 type_setting.add_element('gid').text = @gid 579 type_setting.add_element('add_user_to_local').text = @add_user_to_local 580 type_setting.add_element('cached_credentials').text = @cached_credentials 581 type_setting.add_element('users_ou').text = @users_ou 582 type_setting.add_element('groups_ou').text = @groups_ou 583 type_setting.add_element('printers_ou').text = @printers_ou 584 type_setting.add_element('shared_folders_ou').text = @shared_folders_ou 585 type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? 586 587 type_setting 588 end
Map specific 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/admitmac.rb 277 def uid=(newvalue) 278 new = 279 if newvalue.to_s.empty? 280 Jamf::BLANK 281 else 282 # Data Check 283 raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? 284 285 newvalue 286 end 287 288 @uid = new 289 290 container&.should_update 291 end
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/admitmac.rb 302 def user_gid=(newvalue) 303 new = 304 if newvalue.to_s.empty? 305 Jamf::BLANK 306 else 307 # Data Check 308 raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? 309 310 newvalue 311 end 312 313 @user_gid = new 314 315 container&.should_update 316 end
An OU path for specific Users
@author Tyler Morgan
@param newvalue [String] The OU path for the specific user @note Not sure what this is used for
@raise [Jamf::InvalidDataError] If the new value is not a String
@return [void]
# File lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb 426 def users_ou=(newvalue) 427 new = 428 if newvalue.to_s.empty? 429 Jamf::BLANK 430 else 431 # Data Check 432 raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? 433 434 newvalue 435 end 436 437 @users_ou = new 438 439 container&.should_update 440 end