ruby-jss 1.2.10 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ruby-jss might be problematic. Click here for more details.

Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +208 -1
  3. data/lib/jamf.rb +18 -16
  4. data/lib/jamf/api/base_classes/collection_resource.rb +613 -0
  5. data/lib/jamf/api/{abstract_classes → base_classes}/json_object.rb +110 -102
  6. data/lib/jamf/api/{abstract_classes → base_classes}/prestage.rb +56 -31
  7. data/lib/jamf/api/{abstract_classes → base_classes}/resource.rb +10 -6
  8. data/lib/jamf/api/{abstract_classes → base_classes}/singleton_resource.rb +4 -3
  9. data/lib/jamf/api/connection.rb +20 -12
  10. data/lib/jamf/api/connection/api_error.rb +8 -8
  11. data/lib/jamf/api/connection/token.rb +36 -15
  12. data/lib/jamf/api/json_objects/device_enrollment_device.rb +14 -7
  13. data/lib/jamf/api/json_objects/{location.rb → device_enrollment_device_sync_state.rb} +27 -41
  14. data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +1 -1
  15. data/lib/jamf/api/json_objects/{attachment.rb → locale.rb} +14 -23
  16. data/lib/jamf/api/json_objects/md_prestage_name.rb +1 -1
  17. data/lib/jamf/api/json_objects/md_prestage_names.rb +2 -2
  18. data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +50 -1
  19. data/lib/jamf/api/json_objects/prestage_assignment.rb +2 -2
  20. data/lib/jamf/api/json_objects/prestage_location.rb +3 -3
  21. data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +7 -7
  22. data/lib/jamf/api/json_objects/prestage_scope.rb +1 -1
  23. data/lib/jamf/api/{resources/collection_resources → json_objects}/time_zone.rb +9 -23
  24. data/lib/jamf/api/mixins/{abstract.rb → base_class.rb} +34 -16
  25. data/lib/jamf/api/mixins/bulk_deletable.rb +27 -6
  26. data/lib/jamf/api/mixins/change_log.rb +201 -51
  27. data/lib/jamf/api/{resources/collection_resources/extension_attribute.rb → mixins/filterable.rb} +20 -14
  28. data/lib/jamf/api/mixins/pageable.rb +208 -0
  29. data/lib/jamf/api/{json_objects/installed_application.rb → mixins/sortable.rb} +33 -33
  30. data/lib/jamf/api/resources/collection_resources/building.rb +16 -9
  31. data/lib/jamf/api/resources/collection_resources/category.rb +5 -4
  32. data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +12 -5
  33. data/lib/jamf/api/resources/collection_resources/department.rb +1 -3
  34. data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +13 -13
  35. data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +11 -3
  36. data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +25 -23
  37. data/lib/jamf/api/resources/collection_resources/script.rb +61 -25
  38. data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +15 -5
  39. data/lib/jamf/api/resources/singleton_resources/locales.rb +155 -0
  40. data/lib/jamf/api/resources/singleton_resources/time_zones.rb +213 -0
  41. data/lib/jamf/configuration.rb +7 -9
  42. data/lib/jamf/ruby_extensions.rb +1 -0
  43. data/lib/jamf/ruby_extensions/array.rb +1 -1
  44. data/lib/jamf/ruby_extensions/array/utils.rb +3 -3
  45. data/lib/jamf/{api/resources/collection_resources/computer.rb → ruby_extensions/dig.rb} +22 -19
  46. data/lib/jamf/validate.rb +63 -24
  47. data/lib/jamf/version.rb +1 -1
  48. data/lib/jss.rb +4 -1
  49. data/lib/jss/api_connection.rb +111 -433
  50. data/lib/jss/api_object.rb +16 -13
  51. data/lib/jss/api_object/advanced_search.rb +27 -26
  52. data/lib/jss/api_object/app_store_country_codes.rb +298 -0
  53. data/lib/jss/api_object/categorizable.rb +1 -1
  54. data/lib/jss/api_object/computer.rb +13 -0
  55. data/lib/jss/api_object/configuration_profile.rb +60 -4
  56. data/lib/jss/api_object/directory_binding.rb +273 -0
  57. data/lib/jss/api_object/directory_binding_type.rb +96 -0
  58. data/lib/jss/api_object/directory_binding_type/active_directory.rb +539 -0
  59. data/lib/jss/api_object/directory_binding_type/admitmac.rb +594 -0
  60. data/lib/jss/api_object/directory_binding_type/centrify.rb +226 -0
  61. data/lib/jss/api_object/directory_binding_type/open_directory.rb +178 -0
  62. data/lib/jss/api_object/directory_binding_type/powerbroker_identity_services.rb +73 -0
  63. data/lib/jss/api_object/disk_encryption_configurations.rb +114 -0
  64. data/lib/jss/api_object/distribution_point.rb +97 -37
  65. data/lib/jss/api_object/dock_item.rb +143 -0
  66. data/lib/jss/api_object/ebook.rb +1 -2
  67. data/lib/jss/api_object/extendable.rb +1 -1
  68. data/lib/jss/api_object/extension_attribute.rb +4 -3
  69. data/lib/jss/api_object/group.rb +33 -2
  70. data/lib/jss/api_object/mac_application.rb +107 -8
  71. data/lib/jss/api_object/mobile_device_application.rb +12 -0
  72. data/lib/jss/api_object/network_segment.rb +195 -70
  73. data/lib/jss/api_object/package.rb +105 -40
  74. data/lib/jss/api_object/patch_source.rb +10 -9
  75. data/lib/jss/api_object/policy.rb +596 -32
  76. data/lib/jss/api_object/printer.rb +446 -0
  77. data/lib/jss/api_object/scopable.rb +10 -15
  78. data/lib/jss/api_object/scopable/scope.rb +371 -55
  79. data/lib/jss/api_object/self_servable.rb +17 -9
  80. data/lib/jss/api_object/uploadable.rb +1 -1
  81. data/lib/jss/api_object/user.rb +42 -1
  82. data/lib/jss/api_object/vpp_account.rb +209 -0
  83. data/lib/jss/api_object/vppable.rb +169 -13
  84. data/lib/jss/composer.rb +1 -1
  85. data/lib/jss/exceptions.rb +3 -0
  86. data/lib/jss/server.rb +15 -0
  87. data/lib/jss/utility.rb +143 -52
  88. data/lib/jss/validate.rb +53 -10
  89. data/lib/jss/version.rb +1 -1
  90. metadata +56 -61
  91. data/lib/jamf/api/abstract_classes/advanced_search.rb +0 -86
  92. data/lib/jamf/api/abstract_classes/collection_resource.rb +0 -433
  93. data/lib/jamf/api/abstract_classes/generic_reference.rb +0 -145
  94. data/lib/jamf/api/abstract_classes/prestage_skip_setup_items.rb +0 -126
  95. data/lib/jamf/api/json_objects/account_prefs.rb +0 -79
  96. data/lib/jamf/api/json_objects/android_details.rb +0 -139
  97. data/lib/jamf/api/json_objects/appletv_details.rb +0 -110
  98. data/lib/jamf/api/json_objects/cellular_network.rb +0 -151
  99. data/lib/jamf/api/json_objects/computer_prestage_skip_setup_items.rb +0 -67
  100. data/lib/jamf/api/json_objects/criterion.rb +0 -152
  101. data/lib/jamf/api/json_objects/extension_attribute_value.rb +0 -128
  102. data/lib/jamf/api/json_objects/installed_certificate.rb +0 -53
  103. data/lib/jamf/api/json_objects/installed_configuration_profile.rb +0 -67
  104. data/lib/jamf/api/json_objects/installed_ebook.rb +0 -58
  105. data/lib/jamf/api/json_objects/installed_provisioning_profile.rb +0 -59
  106. data/lib/jamf/api/json_objects/ios_details.rb +0 -244
  107. data/lib/jamf/api/json_objects/mobile_device_details.rb +0 -219
  108. data/lib/jamf/api/json_objects/mobile_device_security.rb +0 -101
  109. data/lib/jamf/api/json_objects/purchasing_data.rb +0 -125
  110. data/lib/jamf/api/mixins/locatable.rb +0 -124
  111. data/lib/jamf/api/mixins/referable.rb +0 -92
  112. data/lib/jamf/api/resources/collection_resources/account.rb +0 -163
  113. data/lib/jamf/api/resources/collection_resources/advanced_mobile_device_search.rb +0 -52
  114. data/lib/jamf/api/resources/collection_resources/advanced_user_search.rb +0 -52
  115. data/lib/jamf/api/resources/collection_resources/mobile_device.rb +0 -315
  116. data/lib/jamf/api/resources/collection_resources/site.rb +0 -77
  117. data/lib/jamf/api/resources/singleton_resources/authorization.rb +0 -88
  118. data/lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb +0 -139
  119. data/lib/jamf/api/resources/singleton_resources/reenrollment_settings.rb +0 -95
@@ -0,0 +1,539 @@
1
+ ### Copyright 2019 Rixar
2
+
3
+ ###
4
+ ### Licensed under the Apache License, Version 2.0 (the "Apache License")
5
+ ### with the following modification; you may not use this file except in
6
+ ### compliance with the Apache License and the following modification to it:
7
+ ### Section 6. Trademarks. is deleted and replaced with:
8
+ ###
9
+ ### 6. Trademarks. This License does not grant permission to use the trade
10
+ ### names, trademarks, service marks, or product names of the Licensor
11
+ ### and its affiliates, except as required to comply with Section 4(c) of
12
+ ### the License and to reproduce the content of the NOTICE file.
13
+ ###
14
+ ### You may obtain a copy of the Apache License at
15
+ ###
16
+ ### http://www.apache.org/licenses/LICENSE-2.0
17
+ ###
18
+ ### Unless required by applicable law or agreed to in writing, software
19
+ ### distributed under the Apache License with the above modification is
20
+ ### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
+ ### KIND, either express or implied. See the Apache License for the specific
22
+ ### language governing permissions and limitations under the Apache License.
23
+ ###
24
+ ###
25
+
26
+ module JSS
27
+
28
+ # Module for containing the different types of DirectoryBindings stored within the JSS
29
+ module DirectoryBindingType
30
+
31
+ # Module Variables
32
+ #####################################
33
+
34
+ # Module Methods
35
+ #####################################
36
+
37
+ # Classes
38
+ #####################################
39
+
40
+ # Class for the specific Active Directory DirectoryBinding type stored within the JSS
41
+ #
42
+ # @author Tyler Morgan
43
+ #
44
+ # Attributes
45
+ # @!attribute [rw] cache_last_user
46
+ # @!attribute [rw] require_confirmation
47
+ # @!attribute [rw] local_home
48
+ # @!attribute [rw] use_unc_path
49
+ # @!attribute [rw] mount_style
50
+ # @!attribute [rw] default_shell
51
+ # @!attribute [rw] uid
52
+ # @!attribute [rw] user_gid
53
+ # @!attribute [rw] gid
54
+ # @!attribute [rw] multiple_domains
55
+ # @!attribute [rw] preferred_domain
56
+ # @!attribute [rw] admin_groups
57
+ # @!attribute [rw] forest
58
+ # TODO: Include default values upon creation
59
+
60
+ class ActiveDirectory < DirectoryBindingType
61
+ # Mix-Ins
62
+ #####################################
63
+
64
+ # Class Methods
65
+ #####################################
66
+
67
+ # Class Constants
68
+ #####################################
69
+
70
+ # Attributes
71
+ #####################################
72
+ attr_reader :cache_last_user
73
+ attr_reader :require_confirmation
74
+ attr_reader :local_home
75
+ attr_reader :use_unc_path
76
+ attr_reader :mount_style
77
+ attr_reader :default_shell
78
+ attr_reader :uid
79
+ attr_reader :user_gid
80
+ attr_reader :gid
81
+ attr_reader :multiple_domains
82
+ attr_reader :preferred_domain
83
+ attr_reader :admin_groups
84
+ attr_reader :forest
85
+
86
+ # Constructor
87
+ #####################################
88
+
89
+ # An initializer for the Active Directory object.
90
+ #
91
+ # @author Tyler Morgan
92
+ # @see JSS::DirectoryBinding
93
+ # @see JSS::DirectoryBindingType
94
+ #
95
+ # @param [Hash] initialize data
96
+ def initialize(init_data)
97
+
98
+ # Return without processing anything since there is
99
+ # nothing to process.
100
+ return if init_data.nil?
101
+
102
+ # Process provided information
103
+ @cache_last_user = init_data[:cache_last_user]
104
+ @require_confirmation = init_data[:require_confirmation]
105
+ @local_home = init_data[:local_home]
106
+ @use_unc_path = init_data[:use_unc_path]
107
+ @default_shell = init_data[:default_shell]
108
+ @uid = init_data[:uid]
109
+ @user_gid = init_data[:user_gid]
110
+ @gid = init_data[:gid]
111
+ @multiple_domains = init_data[:multiple_domains]
112
+ @preferred_domain = init_data[:preferred_domain]
113
+ @forest = init_data[:forest]
114
+
115
+ if init_data[:mount_style].nil? || init_data[:mount_style].is_a?(String)
116
+ raise JSS::InvalidDataError, "Mount style must be one of #{NETWORK_PROTOCOL.values.join(', ')}." unless NETWORK_PROTOCOL.values.map { |x| x.downcase }.include?(init_data[:mount_style].downcase) || init_data[:mount_style].nil?
117
+ @mount_style = init_data[:mount_style]
118
+ else
119
+ raise JSS::InvalidDataError, "Mount style must be one of :#{NETWORK_PROTOCOL.keys.join(',:')}," unless NETWORK_PROTOCOL.keys.include? init_data[:mount_style]
120
+
121
+ @mount_style = NETWORK_PROTOCOL[init_data[:mount_style]]
122
+ end
123
+
124
+ if init_data[:admin_groups].nil?
125
+ # This is needed since we have the ability to add and
126
+ # remove admin groups from this array.
127
+ @admin_groups = []
128
+ elsif init_data[:admin_groups].is_a? String
129
+ @admin_groups = init_data[:admin_groups].split(',')
130
+ else
131
+ @admin_groups = init_data[:admin_groups]
132
+ end
133
+ end
134
+
135
+
136
+
137
+ # Public Instance Methods
138
+ #####################################
139
+
140
+ # Create mobile account upon login
141
+ #
142
+ # @author Tyler Morgan
143
+ #
144
+ # @param newvalue [Bool]
145
+ #
146
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
147
+ #
148
+ # @return [void]
149
+ def cache_last_user=(newvalue)
150
+
151
+ # Data Check
152
+ raise JSS::InvalidDataError, "cache_last_user must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a?(FalseClass)
153
+
154
+ # Update Value
155
+ @cache_last_user = newvalue
156
+
157
+ # Set the object to needing to be updated.
158
+ self.container&.should_update
159
+ end
160
+
161
+
162
+ # Require confirmation before creating a mobile account on the system.
163
+ #
164
+ # @author Tyler Morgan
165
+ #
166
+ # @param newvalue [Bool]
167
+ #
168
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
169
+ #
170
+ # @return [void]
171
+ def require_confirmation=(newvalue)
172
+
173
+ # Data Check
174
+ raise JSS::InvalidDataError, "require_confirmation must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a?(FalseClass)
175
+
176
+ # Update Value
177
+ @require_confirmation = newvalue
178
+
179
+ # Set the object to needing to be updated.
180
+ self.container&.should_update
181
+ end
182
+
183
+
184
+ # Force local home directory to be placed on the startup disk
185
+ #
186
+ # @author Tyler Morgan
187
+ #
188
+ # @param newvalue [Bool]
189
+ #
190
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
191
+ #
192
+ # @return [void]
193
+ def local_home=(newvalue)
194
+
195
+ # Data Check
196
+ raise JSS::InvalidDataError, "local_home must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a?(FalseClass)
197
+
198
+ # Update Value
199
+ @local_home = newvalue
200
+
201
+ # Set the object to needing to be updated.
202
+ self.container&.should_update
203
+ end
204
+
205
+
206
+ # Attempt to derive the network home location using the UNC path stored inside Active Directory
207
+ #
208
+ # @author Tyler Morgan
209
+ #
210
+ # @param newvalue [Bool]
211
+ #
212
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
213
+ #
214
+ # @return [void]
215
+ def use_unc_path=(newvalue)
216
+
217
+ # Data Check
218
+ raise JSS::InvalidDataError, "use_unc_path must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a?(FalseClass)
219
+
220
+ # Update Value
221
+ @use_unc_path = newvalue
222
+
223
+ # Set the object to needing to be updated.
224
+ self.container&.should_update
225
+ end
226
+
227
+
228
+ # The protocol to be use when mounting network home location
229
+ #
230
+ # @author Tyler Morgan
231
+ #
232
+ # @param newvalue [Symbol] One of the keys available in NETWORK_PROTOCOL
233
+ # @see JSS::DIRECTORYBINDINGTYPE::NETWORK_PROTOCOL
234
+ #
235
+ # @raise [JSS::InvalidDataError] If the new value provided is not a key inside the NETWORK_PROTOCOL hash.
236
+ #
237
+ # @return [void]
238
+ def mount_style=(newvalue)
239
+
240
+ # Data Check
241
+ raise JSS::InvalidDataError, "mount_style must be one of :#{NETWORK_PROTOCOL.keys.join(',:')}." unless NETWORK_PROTOCOL.keys.include? newvalue
242
+
243
+ # Update Value
244
+ @mount_style = newvalue
245
+
246
+ # Set the object to needing to be updated.
247
+ self.container&.should_update
248
+ end
249
+
250
+
251
+ # The directory path to the shell user's default shell will be set to upon login.
252
+ #
253
+ # @author Tyler Morgan
254
+ #
255
+ # @param newvalue [String] Directory path for the specific shell that is wanting to be set.
256
+ #
257
+ # @raise [JSS::InvalidDataError] If the new value is not a String
258
+ #
259
+ # @return [void]
260
+ def default_shell=(newvalue)
261
+
262
+ new =
263
+ if newvalue.to_s.empty?
264
+ JSS::BLANK
265
+ else
266
+ # Data Check
267
+ raise JSS::InvalidDataError, "default_shell must be a string." unless newvalue.is_a? String
268
+ newvalue
269
+ end
270
+
271
+ # Update Value
272
+ @default_shell = new
273
+
274
+ # Set the object to needing to be updated.
275
+ self.container&.should_update
276
+ end
277
+
278
+
279
+ # Map specific a UID to Attribute
280
+ #
281
+ # @author Tyler Morgan
282
+ #
283
+ # @param newvalue [String] The UID you want to be mapped
284
+ #
285
+ # @raise [JSS::InvalidDataError] If the new value is not a String
286
+ #
287
+ # @return [void]
288
+ def uid=(newvalue)
289
+ new =
290
+ if newvalue.to_s.empty?
291
+ JSS::BLANK
292
+ else
293
+ # Data Check
294
+ raise JSS::InvalidDataError, "uid must be either an integer or a string." unless (newvalue.is_a? Integer || newvalue.is_a?(String))
295
+ newvalue
296
+ end
297
+
298
+ # Update Value
299
+ @uid = new
300
+
301
+ # Set the object to needing to be updated.
302
+ self.container&.should_update
303
+ end
304
+
305
+
306
+ # Specify a specific forest within Active Directory
307
+ #
308
+ # @author Tyler Morgan
309
+ #
310
+ # @param newvalue [String] The forest you want to specify
311
+ #
312
+ # @raise [JSS::InvalidDataError] If the new value is not a String
313
+ #
314
+ # @return [void]
315
+ def forest=(newvalue)
316
+ new =
317
+ if newvalue.to_s.empty?
318
+ JSS::BLANK
319
+ else
320
+ # Data Check
321
+ raise JSS::InvalidDataError, "forest must be a string." unless newvalue.is_a? String
322
+ newvalue
323
+ end
324
+
325
+ # Update Value
326
+ @forest = new
327
+
328
+ # Set the object to needing to be updated.
329
+ self.container&.should_update
330
+ end
331
+
332
+ # Map specific a User's GID to Attribute
333
+ #
334
+ # @author Tyler Morgan
335
+ #
336
+ # @param newvalue [String] The User's GID you want to be mapped
337
+ #
338
+ # @raise [JSS::InvalidDataError] If the new value is not a String
339
+ #
340
+ # @return [void]
341
+ def user_gid=(newvalue)
342
+ new =
343
+ if newvalue.to_s.empty?
344
+ JSS::BLANK
345
+ else
346
+ # Data Check
347
+ raise JSS::InvalidDataError, "user_gid must be either an integer or a string." unless (newvalue.is_a? Integer || newvalue.is_a?(String))
348
+ newvalue
349
+ end
350
+
351
+ # Update Value
352
+ @user_gid = new
353
+
354
+ # Set the object to needing to be updated.
355
+ self.container&.should_update
356
+ end
357
+
358
+
359
+ # Map specific a GID to Attribute
360
+ #
361
+ # @author Tyler Morgan
362
+ #
363
+ # @param newvalue [String] The GID you want to be mapped
364
+ #
365
+ # @raise [JSS::InvalidDataError] If the new value is not a String
366
+ #
367
+ # @return [void]
368
+ def gid=(newvalue)
369
+ new =
370
+ if newvalue.to_s.empty?
371
+ JSS::BLANK
372
+ else
373
+ # Data Check
374
+ raise JSS::InvalidDataError, "gid must be either an integer or a string." unless (newvalue.is_a? Integer || newvalue.is_a?(String))
375
+ newvalue
376
+ end
377
+
378
+ # Update Value
379
+ @gid = new
380
+
381
+ # Set the object to needing to be updated.
382
+ self.container&.should_update
383
+ end
384
+
385
+
386
+ # Will this computer be possibly connecting to multiple domains
387
+ #
388
+ # @author Tyler Morgan
389
+ #
390
+ # @param newvalue [Bool]
391
+ #
392
+ # @raise [JSS::InvalidDataError] If the provided value is not a Bool.
393
+ #
394
+ # @return [void]
395
+ def multiple_domains=(newvalue)
396
+
397
+ # Data Check
398
+ raise JSS::InvalidDataError, "multiple_domains must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a?(FalseClass)
399
+
400
+ # Update Value
401
+ @multiple_domains = newvalue
402
+
403
+ # Set the object to needing to be updated.
404
+ self.container&.should_update
405
+ end
406
+
407
+
408
+ # What domain server should be highest priority
409
+ #
410
+ # @author Tyler Morgan
411
+ #
412
+ # @param newvalue [String]
413
+ #
414
+ # @raise [JSS::InvalidDataError] If the provided value is not a String.
415
+ #
416
+ # @return [void]
417
+ def preferred_domain=(newvalue)
418
+ new =
419
+ if newvalue.to_s.empty?
420
+ JSS::BLANK
421
+ else
422
+ # Data Check
423
+ raise JSS::InvalidDataError, "preferred_domain must be a string." unless newvalue.is_a? String
424
+ newvalue
425
+ end
426
+
427
+ # Update Value
428
+ @preferred_domain = new
429
+
430
+ # Set the object to needing to be updated.
431
+ self.container&.should_update
432
+ end
433
+
434
+
435
+ # The AD group which can be considered administrators of a device.
436
+ #
437
+ # @author Tyler Morgan
438
+ #
439
+ # @param newvalue [Array <String>]
440
+ #
441
+ # @raise [JSS::InvalidDataError] If the provided value is not an Array.
442
+ #
443
+ # @return [void]
444
+ def admin_groups=(newvalue)
445
+ new =
446
+ if newvalue.to_s.empty?
447
+ JSS::BLANK
448
+ else
449
+ # Data Check
450
+ raise JSS::InvalidDataError, "admin_groups must be either a string or an array of strings." unless (newvalue.is_a? String || newvalue.is_a?(Array))
451
+
452
+ if newvalue.is_a? Array
453
+ newvalue.join ","
454
+ else
455
+ newvalue
456
+ end
457
+ end
458
+
459
+ # Update Value
460
+ @admin_groups = new
461
+
462
+ # Set the object to needing to be updated.
463
+ self.container&.should_update
464
+ end
465
+
466
+
467
+ # Add a specific admin group to the admin_groups
468
+ #
469
+ # @author Tyler Morgan
470
+ #
471
+ # @param newvalue [String] The admin group name you want to add to the admin group list
472
+ #
473
+ # @raise [JSS::InvalidDataError] If the value provided is not a String
474
+ # @raise [JSS::InvalidDataError] If the group provided is not in the admin_group array
475
+ #
476
+ # @return [Array <String>] An array of all the admin groups currently set.
477
+ def add_admin_group(value)
478
+
479
+ raise JSS::InvalidDataError, "Admin group must be a string." unless value.is_a? String
480
+ raise JSS::InvalidDataError, "Group \"#{value}\" already is in the admin groups." unless !@admin_groups.include? value
481
+
482
+ @admin_groups << value
483
+ # Set the object to needing to be updated.
484
+ self.container&.should_update
485
+
486
+ return @admin_groups
487
+ end
488
+
489
+
490
+ # Remove a specific admin group from the admin_groups
491
+ #
492
+ # @author Tyler Morgan
493
+ #
494
+ # @param newvalue [String] The admin group name you want to remove from the admin groups.
495
+ #
496
+ # @raise [JSS::InvalidDataError] If the value provided is not a String
497
+ # @raise [JSS::InvalidDataError] If the group provided is not in the admin_group array
498
+ #
499
+ # @return [Array <String>] An array of all the admin groups currently set.
500
+ def remove_admin_group(value)
501
+
502
+ raise JSS::InvalidDataError, "Admin group being removed must be a string." unless value.is_a? String
503
+ raise JSS::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_groups.include? value
504
+
505
+ @admin_groups.delete value
506
+ # Set the object to needing to be updated.
507
+ self.container&.should_update
508
+
509
+ return @admin_groups
510
+ end
511
+
512
+
513
+ # Return a REXML Element containing the current state of the DirectoryBindingType
514
+ # object for adding into the XML of the container.
515
+ #
516
+ # @author Tyler Morgan
517
+ #
518
+ # @return [REXML::Element]
519
+ def type_setting_xml
520
+ type_setting = REXML::Element.new "active_directory"
521
+ type_setting.add_element("cache_last_user").text = @cache_last_user
522
+ type_setting.add_element("require_confirmation").text = @require_confirmation
523
+ type_setting.add_element("local_home").text = @local_home
524
+ type_setting.add_element("use_unc_path").text = @use_unc_path
525
+ type_setting.add_element("mount_style").text = @mount_style.downcase
526
+ type_setting.add_element("default_shell").text = @default_shell
527
+ type_setting.add_element("uid").text = @uid
528
+ type_setting.add_element("user_gid").text = @user_gid
529
+ type_setting.add_element("gid").text = @gid
530
+ type_setting.add_element("multiple_domains").text = @multiple_domains
531
+ type_setting.add_element("preferred_domain").text = @preferred_domain
532
+ type_setting.add_element("admin_groups").text = @admin_groups.join(',').to_s unless @admin_groups.nil?
533
+ type_setting.add_element("forest").text = @forest.to_s
534
+
535
+ return type_setting
536
+ end
537
+ end
538
+ end
539
+ end