ruby-jss 1.2.9 → 1.5.1
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.
- checksums.yaml +4 -4
- data/CHANGES.md +196 -1
- data/lib/jamf.rb +10 -3
- data/lib/jamf/api/abstract_classes/collection_resource.rb +329 -150
- data/lib/jamf/api/abstract_classes/generic_reference.rb +9 -1
- data/lib/jamf/api/abstract_classes/json_object.rb +107 -83
- data/lib/jamf/api/abstract_classes/prestage.rb +55 -30
- data/lib/jamf/api/abstract_classes/prestage_skip_setup_items.rb +21 -0
- data/lib/jamf/api/abstract_classes/resource.rb +4 -4
- data/lib/jamf/api/abstract_classes/singleton_resource.rb +1 -1
- data/lib/jamf/api/connection.rb +20 -12
- data/lib/jamf/api/connection/api_error.rb +8 -8
- data/lib/jamf/api/connection/token.rb +36 -15
- data/lib/jamf/api/json_objects/computer_prestage_skip_setup_items.rb +14 -1
- data/lib/jamf/api/json_objects/device_enrollment_device.rb +14 -7
- data/lib/jamf/api/json_objects/device_enrollment_device_sync_state.rb +81 -0
- data/lib/jamf/api/json_objects/locale.rb +59 -0
- data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +50 -1
- data/lib/jamf/api/json_objects/prestage_location.rb +3 -3
- data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +7 -7
- data/lib/jamf/api/json_objects/prestage_scope.rb +1 -1
- data/lib/jamf/api/{resources/collection_resources → json_objects}/time_zone.rb +9 -23
- data/lib/jamf/api/mixins/bulk_deletable.rb +27 -6
- data/lib/jamf/api/mixins/change_log.rb +201 -51
- data/lib/jamf/api/mixins/filterable.rb +51 -0
- data/lib/jamf/api/mixins/pageable.rb +208 -0
- data/lib/jamf/api/mixins/sortable.rb +59 -0
- data/lib/jamf/api/resources/collection_resources/building.rb +19 -8
- data/lib/jamf/api/resources/collection_resources/category.rb +5 -3
- data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +11 -4
- data/lib/jamf/api/resources/collection_resources/department.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +13 -13
- data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +11 -3
- data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +24 -22
- data/lib/jamf/api/resources/collection_resources/script.rb +61 -25
- data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +15 -5
- data/lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb +14 -14
- data/lib/jamf/api/resources/singleton_resources/locales.rb +155 -0
- data/lib/jamf/api/resources/singleton_resources/time_zones.rb +213 -0
- data/lib/jamf/configuration.rb +7 -9
- data/lib/jamf/ruby_extensions.rb +1 -0
- data/lib/jamf/ruby_extensions/array.rb +1 -1
- data/lib/jamf/ruby_extensions/array/utils.rb +3 -3
- data/lib/jamf/ruby_extensions/dig.rb +52 -0
- data/lib/jamf/validate.rb +63 -24
- data/lib/jamf/version.rb +1 -1
- data/lib/jss.rb +4 -1
- data/lib/jss/api_connection.rb +110 -397
- data/lib/jss/api_object.rb +16 -13
- data/lib/jss/api_object/advanced_search.rb +27 -26
- data/lib/jss/api_object/app_store_country_codes.rb +298 -0
- data/lib/jss/api_object/categorizable.rb +1 -1
- data/lib/jss/api_object/computer.rb +5 -1
- data/lib/jss/api_object/configuration_profile.rb +34 -3
- data/lib/jss/api_object/directory_binding.rb +273 -0
- data/lib/jss/api_object/directory_binding_type.rb +96 -0
- data/lib/jss/api_object/directory_binding_type/active_directory.rb +539 -0
- data/lib/jss/api_object/directory_binding_type/admitmac.rb +594 -0
- data/lib/jss/api_object/directory_binding_type/centrify.rb +226 -0
- data/lib/jss/api_object/directory_binding_type/open_directory.rb +178 -0
- data/lib/jss/api_object/directory_binding_type/powerbroker_identity_services.rb +73 -0
- data/lib/jss/api_object/disk_encryption_configurations.rb +114 -0
- data/lib/jss/api_object/distribution_point.rb +97 -37
- data/lib/jss/api_object/dock_item.rb +143 -0
- data/lib/jss/api_object/ebook.rb +1 -2
- data/lib/jss/api_object/extendable.rb +68 -32
- data/lib/jss/api_object/extension_attribute.rb +4 -3
- data/lib/jss/api_object/group.rb +33 -2
- data/lib/jss/api_object/mac_application.rb +107 -8
- data/lib/jss/api_object/mobile_device.rb +3 -0
- data/lib/jss/api_object/mobile_device_application.rb +12 -0
- data/lib/jss/api_object/network_segment.rb +195 -70
- data/lib/jss/api_object/package.rb +105 -40
- data/lib/jss/api_object/patch_source.rb +10 -9
- data/lib/jss/api_object/policy.rb +491 -7
- data/lib/jss/api_object/printer.rb +446 -0
- data/lib/jss/api_object/scopable.rb +10 -15
- data/lib/jss/api_object/scopable/scope.rb +386 -71
- data/lib/jss/api_object/self_servable.rb +17 -9
- data/lib/jss/api_object/uploadable.rb +1 -1
- data/lib/jss/api_object/user.rb +42 -1
- data/lib/jss/api_object/vpp_account.rb +209 -0
- data/lib/jss/api_object/vppable.rb +169 -13
- data/lib/jss/composer.rb +1 -1
- data/lib/jss/exceptions.rb +3 -0
- data/lib/jss/server.rb +15 -0
- data/lib/jss/utility.rb +8 -22
- data/lib/jss/validate.rb +53 -10
- data/lib/jss/version.rb +1 -1
- metadata +50 -22
@@ -0,0 +1,594 @@
|
|
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
|
+
|
30
|
+
module DirectoryBindingType
|
31
|
+
|
32
|
+
# Module Variables
|
33
|
+
#####################################
|
34
|
+
|
35
|
+
# Module Methods
|
36
|
+
#####################################
|
37
|
+
|
38
|
+
# Classes
|
39
|
+
#####################################
|
40
|
+
|
41
|
+
# Class for the specific ADmitMac DirectoryBinding type stored within the JSS
|
42
|
+
#
|
43
|
+
# @author Tyler Morgan
|
44
|
+
#
|
45
|
+
# @note "Map Home Directory To Attribute" is currently only available in the Jamf Pro UI not through the API.
|
46
|
+
#
|
47
|
+
# Attributes
|
48
|
+
# @!attribute [rw] require_confirmation
|
49
|
+
# @!attribute [rw] local_home
|
50
|
+
# @!attribute [rw] mount_style
|
51
|
+
# @!attribute [rw] default_shell
|
52
|
+
# @!attribute [rw] mount_network_home
|
53
|
+
# @!attribute [rw] place_home_folders
|
54
|
+
# @!attribute [rw] uid
|
55
|
+
# @!attribute [rw] user_gid
|
56
|
+
# @!attribute [rw] gid
|
57
|
+
# @!attribute [rw] admin_group
|
58
|
+
# @!attribute [rw] cached_credentials
|
59
|
+
# @!attribute [rw] add_user_to_local
|
60
|
+
# @!attribute [rw] users_ou
|
61
|
+
# @!attribute [rw] groups_ou
|
62
|
+
# @!attribute [rw] printers_ou
|
63
|
+
# @!attribute [rw] shared_folders_ou
|
64
|
+
# TODO: Include default values upon creation
|
65
|
+
class ADmitMac < DirectoryBindingType
|
66
|
+
|
67
|
+
# Mix-Ins
|
68
|
+
#####################################
|
69
|
+
|
70
|
+
# Class Methods
|
71
|
+
#####################################
|
72
|
+
|
73
|
+
# Class Constants
|
74
|
+
#####################################
|
75
|
+
|
76
|
+
# Attributes
|
77
|
+
#####################################
|
78
|
+
|
79
|
+
attr_reader :require_confirmation
|
80
|
+
attr_reader :local_home
|
81
|
+
attr_reader :mount_style
|
82
|
+
attr_reader :default_shell
|
83
|
+
attr_reader :mount_network_home
|
84
|
+
attr_reader :place_home_folders
|
85
|
+
attr_reader :uid
|
86
|
+
attr_reader :user_gid
|
87
|
+
attr_reader :gid
|
88
|
+
attr_reader :admin_group
|
89
|
+
attr_reader :cached_credentials
|
90
|
+
attr_reader :add_user_to_local
|
91
|
+
attr_reader :users_ou
|
92
|
+
attr_reader :groups_ou
|
93
|
+
attr_reader :printers_ou
|
94
|
+
attr_reader :shared_folders_ou
|
95
|
+
|
96
|
+
# Constructor
|
97
|
+
#####################################
|
98
|
+
|
99
|
+
# An initializer for the ADmitMac object.
|
100
|
+
#
|
101
|
+
# @author Tyler Morgan
|
102
|
+
# @see JSS::DirectoryBinding
|
103
|
+
# @see JSS::DirectoryBindingType
|
104
|
+
#
|
105
|
+
# @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
|
106
|
+
#
|
107
|
+
# @param [Hash] initialize data
|
108
|
+
def initialize(init_data)
|
109
|
+
# Return without processing anything since there is
|
110
|
+
# nothing to process.
|
111
|
+
return if init_data.nil?
|
112
|
+
|
113
|
+
# Process the provided information
|
114
|
+
@require_confirmation = init_data[:require_confirmation]
|
115
|
+
@default_shell = init_data[:default_shell]
|
116
|
+
@mount_network_home = init_data[:mount_network_home]
|
117
|
+
@place_home_folders = init_data[:place_home_folders]
|
118
|
+
@uid = init_data[:uid]
|
119
|
+
@user_gid = init_data[:user_gid]
|
120
|
+
@gid = init_data[:gid]
|
121
|
+
@cached_credentials = init_data[:cached_credentials]
|
122
|
+
@add_user_to_local = init_data[:add_user_to_local]
|
123
|
+
@users_ou = init_data[:users_ou]
|
124
|
+
@groups_ou = init_data[:groups_ou]
|
125
|
+
@printers_ou = init_data[:printers_ou]
|
126
|
+
@shared_folders_ou = init_data[:shared_folders_ou]
|
127
|
+
@mount_style = init_data[:mount_style]
|
128
|
+
|
129
|
+
if init_data[:local_home].nil? || init_data[:local_home].is_a?(String)
|
130
|
+
unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil?
|
131
|
+
raise JSS::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}."
|
132
|
+
end
|
133
|
+
|
134
|
+
@local_home = init_data[:local_home]
|
135
|
+
else
|
136
|
+
unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home]
|
137
|
+
raise JSS::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}."
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
@admin_group = if init_data[:admin_group].nil?
|
142
|
+
# This is needed since we have the ability to add and
|
143
|
+
# remove admin groups from this array.
|
144
|
+
[]
|
145
|
+
elsif init_data[:admin_group].is_a? String
|
146
|
+
init_data[:admin_group].split(',')
|
147
|
+
else
|
148
|
+
init_data[:admin_group]
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# Public Instance Methods
|
153
|
+
#####################################
|
154
|
+
|
155
|
+
# Require confirmation before creating a mobile account on the system.
|
156
|
+
#
|
157
|
+
# @author Tyler Morgan
|
158
|
+
#
|
159
|
+
# @param newvalue [Bool]
|
160
|
+
#
|
161
|
+
# @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
|
162
|
+
#
|
163
|
+
# @return [void]
|
164
|
+
def require_confirmation=(newvalue)
|
165
|
+
raise JSS::InvalidDataError, 'require_confirmation must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
166
|
+
|
167
|
+
@require_confirmation = newvalue
|
168
|
+
|
169
|
+
container&.should_update
|
170
|
+
end
|
171
|
+
|
172
|
+
# The type of home directory type created upon logging into a system
|
173
|
+
#
|
174
|
+
# @author Tyler Morgan
|
175
|
+
#
|
176
|
+
# @param newvalue [Symbol] The key specific to the folder type you want in HOME_FOLDER_TYPE
|
177
|
+
# @see JSS::DirectoryBindingType::HOME_FOLDER_TYPE
|
178
|
+
#
|
179
|
+
# @raise [JSS::InvalidDataError] If the new value is not one of the possible keys in HOME_FOLDER_TYPE
|
180
|
+
#
|
181
|
+
# @return [void]
|
182
|
+
def local_home=(newvalue)
|
183
|
+
new =
|
184
|
+
if newvalue.to_s.empty?
|
185
|
+
JSS::BLANK
|
186
|
+
else
|
187
|
+
# Data Check
|
188
|
+
raise JSS::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue
|
189
|
+
|
190
|
+
HOME_FOLDER_TYPE[newvalue]
|
191
|
+
end
|
192
|
+
|
193
|
+
@local_home = new
|
194
|
+
|
195
|
+
container&.should_update
|
196
|
+
end
|
197
|
+
|
198
|
+
# The default shell assigned first upon logging into a system
|
199
|
+
#
|
200
|
+
# @author Tyler Morgan
|
201
|
+
#
|
202
|
+
# @param newvalue [String] The string path of the shell file being set as the default
|
203
|
+
#
|
204
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
205
|
+
#
|
206
|
+
# @return [void]
|
207
|
+
def default_shell=(newvalue)
|
208
|
+
new =
|
209
|
+
if newvalue.to_s.empty?
|
210
|
+
JSS::BLANK
|
211
|
+
else
|
212
|
+
# Data Check
|
213
|
+
raise JSS::InvalidDataError, 'default_shell must be empty or a string.' unless newvalue.is_a?(String)
|
214
|
+
|
215
|
+
newvalue
|
216
|
+
end
|
217
|
+
|
218
|
+
@default_shell = new
|
219
|
+
|
220
|
+
container&.should_update
|
221
|
+
end
|
222
|
+
|
223
|
+
# Mount network home folder on desktop
|
224
|
+
#
|
225
|
+
# @author Tyler Morgan
|
226
|
+
#
|
227
|
+
# @param newvalue [Bool]
|
228
|
+
#
|
229
|
+
# @raise [JSS::InvalidDataError] If the new value is not a Bool
|
230
|
+
#
|
231
|
+
# @return [void]
|
232
|
+
def mount_network_home=(newvalue)
|
233
|
+
raise JSS::InvalidDataError, 'mount_network_home must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
234
|
+
|
235
|
+
@mount_network_home = newvalue
|
236
|
+
|
237
|
+
container&.should_update
|
238
|
+
end
|
239
|
+
|
240
|
+
# Path at which home folders are placed
|
241
|
+
#
|
242
|
+
# @author Tyler Morgan
|
243
|
+
#
|
244
|
+
# @param newvalue [String] The string path of the folder which user's directory files and folders will be created
|
245
|
+
#
|
246
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
247
|
+
#
|
248
|
+
# @return [void]
|
249
|
+
def place_home_folders=(newvalue)
|
250
|
+
new =
|
251
|
+
if newvalue.to_s.empty?
|
252
|
+
JSS::BLANK
|
253
|
+
else
|
254
|
+
# Data Check
|
255
|
+
raise JSS::InvalidDataError, 'place_home_folders must be a string.' unless newvalue.is_a? String
|
256
|
+
|
257
|
+
newvalue
|
258
|
+
end
|
259
|
+
|
260
|
+
@place_home_folders = new
|
261
|
+
|
262
|
+
container&.should_update
|
263
|
+
end
|
264
|
+
|
265
|
+
# Jamf has these linked for some reason...
|
266
|
+
alias mount_style place_home_folders
|
267
|
+
|
268
|
+
# Map specific UID to Attribute
|
269
|
+
#
|
270
|
+
# @author Tyler Morgan
|
271
|
+
#
|
272
|
+
# @param newvalue [String] The UID you want to be mapped
|
273
|
+
#
|
274
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
275
|
+
#
|
276
|
+
# @return [void]
|
277
|
+
def uid=(newvalue)
|
278
|
+
new =
|
279
|
+
if newvalue.to_s.empty?
|
280
|
+
JSS::BLANK
|
281
|
+
else
|
282
|
+
# Data Check
|
283
|
+
raise JSS::InvalidDataError, 'uid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil?
|
284
|
+
|
285
|
+
newvalue
|
286
|
+
end
|
287
|
+
|
288
|
+
@uid = new
|
289
|
+
|
290
|
+
container&.should_update
|
291
|
+
end
|
292
|
+
|
293
|
+
# Map specific a User's GID to Attribute
|
294
|
+
#
|
295
|
+
# @author Tyler Morgan
|
296
|
+
#
|
297
|
+
# @param newvalue [String] The User's GID you want to be mapped
|
298
|
+
#
|
299
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
300
|
+
#
|
301
|
+
# @return [void]
|
302
|
+
def user_gid=(newvalue)
|
303
|
+
new =
|
304
|
+
if newvalue.to_s.empty?
|
305
|
+
JSS::BLANK
|
306
|
+
else
|
307
|
+
# Data Check
|
308
|
+
raise JSS::InvalidDataError, 'user_gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil?
|
309
|
+
|
310
|
+
newvalue
|
311
|
+
end
|
312
|
+
|
313
|
+
@user_gid = new
|
314
|
+
|
315
|
+
container&.should_update
|
316
|
+
end
|
317
|
+
|
318
|
+
# Map specific GID to Attribute
|
319
|
+
#
|
320
|
+
# @author Tyler Morgan
|
321
|
+
#
|
322
|
+
# @param newvalue [String] The GID you want to be mapped
|
323
|
+
#
|
324
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
325
|
+
#
|
326
|
+
# @return [void]
|
327
|
+
def gid=(newvalue)
|
328
|
+
new =
|
329
|
+
if newvalue.to_s.empty?
|
330
|
+
JSS::BLANK
|
331
|
+
else
|
332
|
+
# Data Check
|
333
|
+
raise JSS::InvalidDataError, 'gid must be a string, integer, or nil.' unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil?
|
334
|
+
|
335
|
+
newvalue
|
336
|
+
end
|
337
|
+
|
338
|
+
@gid = new
|
339
|
+
|
340
|
+
container&.should_update
|
341
|
+
end
|
342
|
+
|
343
|
+
# Set specific groups to become administrators to a system.
|
344
|
+
#
|
345
|
+
# @author Tyler Morgan
|
346
|
+
#
|
347
|
+
# @param newvalue [Array<String>] An array of all the admin group names you want to set.
|
348
|
+
# @see add_admin_group
|
349
|
+
# @see remove_admin_group
|
350
|
+
#
|
351
|
+
# @raise [JSS::InvalidDataError] If the new value is not an Array
|
352
|
+
#
|
353
|
+
# @return [void]
|
354
|
+
def admin_group=(newvalue)
|
355
|
+
new =
|
356
|
+
if newvalue.to_s.empty?
|
357
|
+
JSS::BLANK
|
358
|
+
else
|
359
|
+
# Data Check
|
360
|
+
unless newvalue.is_a? Array
|
361
|
+
raise JSS::InvalidDataError, 'An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals.'
|
362
|
+
end
|
363
|
+
|
364
|
+
newvalue
|
365
|
+
end
|
366
|
+
|
367
|
+
@admin_group = new
|
368
|
+
|
369
|
+
container&.should_update
|
370
|
+
end
|
371
|
+
|
372
|
+
# The number of times a user can log into the device while not connected to a network
|
373
|
+
#
|
374
|
+
# @author Tyler Morgan
|
375
|
+
#
|
376
|
+
# @param newvalue [Integer] The number of times you want a user to login while not connected to a network
|
377
|
+
#
|
378
|
+
# @raise [JSS::InvalidDataError] If the new value is not an Integer
|
379
|
+
#
|
380
|
+
# @return [void]
|
381
|
+
def cached_credentials=(newvalue)
|
382
|
+
new =
|
383
|
+
if newvalue.to_s.empty?
|
384
|
+
JSS::BLANK
|
385
|
+
else
|
386
|
+
# Data Check
|
387
|
+
raise JSS::InvalidDataError, 'cached_credentials must be an integer.' unless newvalue.is_a? Integer
|
388
|
+
|
389
|
+
newvalue
|
390
|
+
end
|
391
|
+
|
392
|
+
@cached_credentials = new
|
393
|
+
|
394
|
+
container&.should_update
|
395
|
+
end
|
396
|
+
|
397
|
+
# If the user is a member of one of the groups in admin_group, add them
|
398
|
+
# to the local administrator group.
|
399
|
+
#
|
400
|
+
# @author Tyler Morgan
|
401
|
+
# @see admin_group
|
402
|
+
#
|
403
|
+
# @param newvalue [Bool]
|
404
|
+
#
|
405
|
+
# @raise [JSS::InvalidDataError] If the new value is not a Bool
|
406
|
+
#
|
407
|
+
# @return [void]
|
408
|
+
def add_user_to_local=(newvalue)
|
409
|
+
raise JSS::InvalidDataError, 'add_user_to_local must be true or false.' unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
410
|
+
|
411
|
+
@add_user_to_local = newvalue
|
412
|
+
|
413
|
+
container&.should_update
|
414
|
+
end
|
415
|
+
|
416
|
+
# An OU path for specific Users
|
417
|
+
#
|
418
|
+
# @author Tyler Morgan
|
419
|
+
#
|
420
|
+
# @param newvalue [String] The OU path for the specific user
|
421
|
+
# @note Not sure what this is used for
|
422
|
+
#
|
423
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
424
|
+
#
|
425
|
+
# @return [void]
|
426
|
+
def users_ou=(newvalue)
|
427
|
+
new =
|
428
|
+
if newvalue.to_s.empty?
|
429
|
+
JSS::BLANK
|
430
|
+
else
|
431
|
+
# Data Check
|
432
|
+
raise JSS::InvalidDataError, 'users_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil?
|
433
|
+
|
434
|
+
newvalue
|
435
|
+
end
|
436
|
+
|
437
|
+
@users_ou = new
|
438
|
+
|
439
|
+
container&.should_update
|
440
|
+
end
|
441
|
+
|
442
|
+
# An OU path for specific User Groups
|
443
|
+
#
|
444
|
+
# @author Tyler Morgan
|
445
|
+
#
|
446
|
+
# @param newvalue [String] The OU path for the specific user group
|
447
|
+
# @note Not sure what this is used for
|
448
|
+
#
|
449
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
450
|
+
#
|
451
|
+
# @return [void]
|
452
|
+
def groups_ou=(newvalue)
|
453
|
+
new =
|
454
|
+
if newvalue.to_s.empty?
|
455
|
+
JSS::BLANK
|
456
|
+
else
|
457
|
+
# Data Check
|
458
|
+
raise JSS::InvalidDataError, 'groups_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil?
|
459
|
+
|
460
|
+
newvalue
|
461
|
+
end
|
462
|
+
|
463
|
+
@groups_ou = new
|
464
|
+
|
465
|
+
container&.should_update
|
466
|
+
end
|
467
|
+
|
468
|
+
# An OU path for specific Printers
|
469
|
+
#
|
470
|
+
# @author Tyler Morgan
|
471
|
+
#
|
472
|
+
# @param newvalue [String] The OU path for the specific printer
|
473
|
+
# @note Not sure what this is used for
|
474
|
+
#
|
475
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
476
|
+
#
|
477
|
+
# @return [void]
|
478
|
+
def printers_ou=(newvalue)
|
479
|
+
new =
|
480
|
+
if newvalue.to_s.empty?
|
481
|
+
JSS::BLANK
|
482
|
+
else
|
483
|
+
# Data Check
|
484
|
+
raise JSS::InvalidDataError, 'printers_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil?
|
485
|
+
|
486
|
+
newvalue
|
487
|
+
end
|
488
|
+
|
489
|
+
@printers_ou = new
|
490
|
+
|
491
|
+
container&.should_update
|
492
|
+
end
|
493
|
+
|
494
|
+
# An OU path for specific shared folders
|
495
|
+
#
|
496
|
+
# @author Tyler Morgan
|
497
|
+
#
|
498
|
+
# @param newvalue [String] The OU path for the specific shared folders
|
499
|
+
# @note Not sure what this is used for
|
500
|
+
#
|
501
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
502
|
+
#
|
503
|
+
# @return [void]
|
504
|
+
def shared_folders_ou=(newvalue)
|
505
|
+
new =
|
506
|
+
if newvalue.to_s.empty?
|
507
|
+
JSS::BLANK
|
508
|
+
else
|
509
|
+
# Data Check
|
510
|
+
raise JSS::InvalidDataError, 'shared_folders_ou must be either a string or nil.' unless newvalue.is_a? String || newvalue.nil?
|
511
|
+
|
512
|
+
newvalue
|
513
|
+
end
|
514
|
+
|
515
|
+
@shared_folders_ou = new
|
516
|
+
|
517
|
+
container&.should_update
|
518
|
+
end
|
519
|
+
|
520
|
+
# An a specific admin group to admin_group
|
521
|
+
#
|
522
|
+
# @author Tyler Morgan
|
523
|
+
#
|
524
|
+
# @param value [String] The admin group name you wish to add to the admin group list
|
525
|
+
#
|
526
|
+
# @raise [JSS::InvalidDataError] If the value provided is not a String
|
527
|
+
# @raise [JSS::InvalidDataError] If the group provided is already a member of the admin_group array
|
528
|
+
#
|
529
|
+
# @return [Array <String>] An array of all the admin groups currently set.
|
530
|
+
def add_admin_group(value)
|
531
|
+
raise JSS::InvalidDataError, 'Admin group must be a string.' unless value.is_a? String
|
532
|
+
raise JSS::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." if @admin_group.include? value
|
533
|
+
|
534
|
+
@admin_group << value
|
535
|
+
|
536
|
+
container&.should_update
|
537
|
+
|
538
|
+
@admin_group
|
539
|
+
end
|
540
|
+
|
541
|
+
# Remove a specific admin group to admin_group
|
542
|
+
#
|
543
|
+
# @author Tyler Morgan
|
544
|
+
#
|
545
|
+
# @param newvalue [String] The admin group name you wish to remove from the admin group list
|
546
|
+
#
|
547
|
+
# @raise [JSS::InvalidDataError] If the value provided is not a String
|
548
|
+
# @raise [JSS::InvalidDataError] If the group provided is not in the admin_group array
|
549
|
+
#
|
550
|
+
# @return [Array <String>] An array of all the admin groups currently set.
|
551
|
+
def remove_admin_group(value)
|
552
|
+
raise JSS::InvalidDataError, 'Admin group being removed must be a string' unless value.is_a? String
|
553
|
+
raise JSS::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value
|
554
|
+
|
555
|
+
@admin_group.delete value
|
556
|
+
|
557
|
+
container&.should_update
|
558
|
+
|
559
|
+
@admin_group
|
560
|
+
end
|
561
|
+
|
562
|
+
# Return a REXML Element containing the current state of the DirectoryBindingType
|
563
|
+
# object for adding into the XML of the container.
|
564
|
+
#
|
565
|
+
# @author Tyler Morgan
|
566
|
+
#
|
567
|
+
# @return [REXML::Element]
|
568
|
+
def type_setting_xml
|
569
|
+
type_setting = REXML::Element.new 'admitmac'
|
570
|
+
type_setting.add_element('require_confirmation').text = @require_confirmation
|
571
|
+
type_setting.add_element('local_home').text = @local_home
|
572
|
+
type_setting.add_element('mount_style').text = @mount_style.downcase
|
573
|
+
type_setting.add_element('default_shell').text = @default_shell
|
574
|
+
type_setting.add_element('mount_network_home').text = @mount_network_home
|
575
|
+
type_setting.add_element('place_home_folders').text = @place_home_folders
|
576
|
+
type_setting.add_element('uid').text = @uid
|
577
|
+
type_setting.add_element('user_gid').text = @user_gid
|
578
|
+
type_setting.add_element('gid').text = @gid
|
579
|
+
type_setting.add_element('add_user_to_local').text = @add_user_to_local
|
580
|
+
type_setting.add_element('cached_credentials').text = @cached_credentials
|
581
|
+
type_setting.add_element('users_ou').text = @users_ou
|
582
|
+
type_setting.add_element('groups_ou').text = @groups_ou
|
583
|
+
type_setting.add_element('printers_ou').text = @printers_ou
|
584
|
+
type_setting.add_element('shared_folders_ou').text = @shared_folders_ou
|
585
|
+
type_setting.add_element('admin_group').text = @admin_group.join(',').to_s unless @admin_group.nil?
|
586
|
+
|
587
|
+
type_setting
|
588
|
+
end
|
589
|
+
|
590
|
+
end
|
591
|
+
|
592
|
+
end
|
593
|
+
|
594
|
+
end
|