Class: Jamf::DirectoryBindingType::ADmitMac
- Inherits:
-
Jamf::DirectoryBindingType
- Object
- Jamf::DirectoryBindingType
- Jamf::DirectoryBindingType::ADmitMac
- Defined in:
- lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb
Overview
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
Instance Attribute Summary collapse
-
#add_user_to_local ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#admin_group ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#cached_credentials ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#default_shell ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#gid ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#groups_ou ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#local_home ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#mount_network_home ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#mount_style ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#place_home_folders ⇒ Object
(also: #mount_style)
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#printers_ou ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#require_confirmation ⇒ Object
Attributes.
-
#shared_folders_ou ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#uid ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#user_gid ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
-
#users_ou ⇒ Object
Class for the specific ADmitMac DirectoryBinding type stored within the JSS.
Instance Method Summary collapse
-
#add_admin_group(value) ⇒ Array <String>
An a specific admin group to admin_group.
-
#initialize(init_data) ⇒ ADmitMac
constructor
An initializer for the ADmitMac object.
-
#remove_admin_group(value) ⇒ Array <String>
Remove a specific admin group to admin_group.
-
#type_setting_xml ⇒ REXML::Element
Return a REXML Element containing the current state of the DirectoryBindingType object for adding into the XML of the container.
Constructor Details
#initialize(init_data) ⇒ ADmitMac
Due to a JSS API funk, mount_style is not able to be configured through the API. It is linked to place_home_folders
An initializer for the ADmitMac object.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 108 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end |
Instance Attribute Details
#add_user_to_local ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#admin_group ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#cached_credentials ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#default_shell ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#gid ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#groups_ou ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#local_home ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#mount_network_home ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#mount_style=(value) ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#place_home_folders ⇒ Object Also known as: mount_style
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#printers_ou ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#require_confirmation ⇒ Object
Attributes
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#shared_folders_ou ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#uid ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#user_gid ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
#users_ou ⇒ Object
“Map Home Directory To Attribute” is currently only available in the Jamf Pro UI not through the API.
Class for the specific ADmitMac DirectoryBinding type stored within the JSS
Attributes TODO: Include default values upon creation
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 65 class ADmitMac < DirectoryBindingType # Mix-Ins ##################################### # Class Methods ##################################### # Class Constants ##################################### # Attributes ##################################### attr_reader :require_confirmation attr_reader :local_home attr_reader :mount_style attr_reader :default_shell attr_reader :mount_network_home attr_reader :place_home_folders attr_reader :uid attr_reader :user_gid attr_reader :gid attr_reader :admin_group attr_reader :cached_credentials attr_reader :add_user_to_local attr_reader :users_ou attr_reader :groups_ou attr_reader :printers_ou attr_reader :shared_folders_ou # Constructor ##################################### # 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 def initialize(init_data) # Return without processing anything since there is # nothing to process. return if init_data.nil? # Process the provided information @require_confirmation = init_data[:require_confirmation] @default_shell = init_data[:default_shell] @mount_network_home = init_data[:mount_network_home] @place_home_folders = init_data[:place_home_folders] @uid = init_data[:uid] @user_gid = init_data[:user_gid] @gid = init_data[:gid] @cached_credentials = init_data[:cached_credentials] @add_user_to_local = init_data[:add_user_to_local] @users_ou = init_data[:users_ou] @groups_ou = init_data[:groups_ou] @printers_ou = init_data[:printers_ou] @shared_folders_ou = init_data[:shared_folders_ou] @mount_style = init_data[:mount_style] if init_data[:local_home].nil? || init_data[:local_home].is_a?(String) unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil? raise Jamf::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." end @local_home = init_data[:local_home] else unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home] raise Jamf::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." end end @admin_group = if init_data[:admin_group].nil? # This is needed since we have the ability to add and # remove admin groups from this array. [] elsif init_data[:admin_group].is_a? String init_data[:admin_group].split(',') else init_data[:admin_group] end end # Public Instance Methods ##################################### # 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] def require_confirmation=(newvalue) raise Jamf::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @require_confirmation = newvalue container&.should_update 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] def local_home=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue HOME_FOLDER_TYPE[newvalue] end @local_home = new container&.should_update 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] def default_shell=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String) newvalue end @default_shell = new container&.should_update 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] def mount_network_home=(newvalue) raise Jamf::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @mount_network_home = newvalue container&.should_update 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] def place_home_folders=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String newvalue end @place_home_folders = new container&.should_update end # Jamf has these linked for some reason... alias mount_style place_home_folders # 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] def uid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @uid = new container&.should_update 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] def user_gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @user_gid = new container&.should_update 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] def gid=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil? newvalue end @gid = new container&.should_update 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] def admin_group=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check unless newvalue.is_a? Array raise Jamf::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.' end newvalue end @admin_group = new container&.should_update 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] def cached_credentials=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer newvalue end @cached_credentials = new container&.should_update 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] def add_user_to_local=(newvalue) raise Jamf::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass) @add_user_to_local = newvalue container&.should_update 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] def users_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @users_ou = new container&.should_update 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] def groups_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @groups_ou = new container&.should_update 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] def printers_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @printers_ou = new container&.should_update end # An OU path for specific shared folders # # @author Tyler Morgan # # @param newvalue [String] The OU path for the specific shared folders # @note Not sure what this is used for # # @raise [Jamf::InvalidDataError] If the new value is not a String # # @return [void] def shared_folders_ou=(newvalue) new = if newvalue.to_s.empty? Jamf::BLANK else # Data Check raise Jamf::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil? newvalue end @shared_folders_ou = new container&.should_update end # 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. def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group 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. def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group 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] def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end end |
Instance Method Details
#add_admin_group(value) ⇒ Array <String>
An a specific admin group to admin_group
530 531 532 533 534 535 536 537 538 539 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 530 def add_admin_group(value) raise Jamf::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value @admin_group << value container&.should_update @admin_group end |
#remove_admin_group(value) ⇒ Array <String>
Remove a specific admin group to admin_group
551 552 553 554 555 556 557 558 559 560 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 551 def remove_admin_group(value) raise Jamf::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String raise Jamf::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value @admin_group.delete value container&.should_update @admin_group end |
#type_setting_xml ⇒ REXML::Element
Return a REXML Element containing the current state of the DirectoryBindingType object for adding into the XML of the container.
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 |
# File 'lib/jamf/api/classic/api_objects/directory_binding_type/admitmac.rb', line 568 def type_setting_xml type_setting = REXML::Element.new 'admitmac' type_setting.add_element('require_confirmation').text = @require_confirmation type_setting.add_element('local_home').text = @local_home type_setting.add_element('mount_style').text = @mount_style.downcase type_setting.add_element('default_shell').text = @default_shell type_setting.add_element('mount_network_home').text = @mount_network_home type_setting.add_element('place_home_folders').text = @place_home_folders type_setting.add_element('uid').text = @uid type_setting.add_element('user_gid').text = @user_gid type_setting.add_element('gid').text = @gid type_setting.add_element('add_user_to_local').text = @add_user_to_local type_setting.add_element('cached_credentials').text = @cached_credentials type_setting.add_element('users_ou').text = @users_ou type_setting.add_element('groups_ou').text = @groups_ou type_setting.add_element('printers_ou').text = @printers_ou type_setting.add_element('shared_folders_ou').text = @shared_folders_ou type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil? type_setting end |