ruby-jss 1.2.10 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ruby-jss might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGES.md +92 -1
- data/lib/jamf/api/abstract_classes/json_object.rb +1 -1
- data/lib/jamf/api/abstract_classes/prestage.rb +1 -1
- data/lib/jamf/api/connection.rb +7 -3
- 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/jss.rb +2 -0
- data/lib/jss/api_connection.rb +2 -29
- data/lib/jss/api_object.rb +15 -2
- data/lib/jss/api_object/directory_binding.rb +273 -0
- data/lib/jss/api_object/directory_binding_type.rb +90 -0
- data/lib/jss/api_object/directory_binding_type/active_directory.rb +502 -0
- data/lib/jss/api_object/directory_binding_type/admitmac.rb +525 -0
- data/lib/jss/api_object/directory_binding_type/centrify.rb +212 -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 +95 -35
- data/lib/jss/api_object/dock_item.rb +137 -0
- data/lib/jss/api_object/mobile_device_application.rb +12 -0
- data/lib/jss/api_object/network_segment.rb +152 -58
- data/lib/jss/api_object/package.rb +106 -41
- data/lib/jss/api_object/policy.rb +379 -4
- data/lib/jss/api_object/printer.rb +440 -0
- data/lib/jss/api_object/scopable/scope.rb +24 -24
- data/lib/jss/composer.rb +1 -1
- data/lib/jss/utility.rb +8 -22
- data/lib/jss/version.rb +1 -1
- metadata +13 -2
@@ -0,0 +1,90 @@
|
|
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
|
+
def should_update
|
37
|
+
@need_to_update = true
|
38
|
+
end
|
39
|
+
|
40
|
+
def set_type_settings(settings)
|
41
|
+
@type_settings = settings
|
42
|
+
@type_settings.container = self
|
43
|
+
end
|
44
|
+
|
45
|
+
# Classes
|
46
|
+
#####################################
|
47
|
+
|
48
|
+
# A generic binding type class that sets common variables, methods, and constructors
|
49
|
+
# for all the different directory binding types.
|
50
|
+
#
|
51
|
+
# @author Tyler Morgan
|
52
|
+
class DirectoryBindingType
|
53
|
+
# Mix-Ins
|
54
|
+
#####################################
|
55
|
+
|
56
|
+
# Class Methods
|
57
|
+
#####################################
|
58
|
+
|
59
|
+
# Class Constants
|
60
|
+
#####################################
|
61
|
+
|
62
|
+
# The different network protocols supported.
|
63
|
+
NETWORK_PROTOCOL = {
|
64
|
+
afp: "AFP",
|
65
|
+
smb: "SMB"
|
66
|
+
}.freeze
|
67
|
+
|
68
|
+
|
69
|
+
# The different home folder types.
|
70
|
+
HOME_FOLDER_TYPE = {
|
71
|
+
network: "Network",
|
72
|
+
local: "Local",
|
73
|
+
either: "Either",
|
74
|
+
mobile: "Mobile"
|
75
|
+
}.freeze
|
76
|
+
|
77
|
+
# Attributes
|
78
|
+
#####################################
|
79
|
+
|
80
|
+
# This is used to properly handle updating the containing object.
|
81
|
+
attr_accessor :container
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
require "jss/api_object/directory_binding_type/active_directory"
|
87
|
+
require "jss/api_object/directory_binding_type/open_directory"
|
88
|
+
require "jss/api_object/directory_binding_type/admitmac"
|
89
|
+
require "jss/api_object/directory_binding_type/centrify"
|
90
|
+
require "jss/api_object/directory_binding_type/powerbroker_identity_services"
|
@@ -0,0 +1,502 @@
|
|
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
|
+
# Data Check
|
263
|
+
raise JSS::InvalidDataError, "default_shell must be a string." unless newvalue.is_a? String
|
264
|
+
|
265
|
+
# Update Value
|
266
|
+
@default_shell = newvalue
|
267
|
+
|
268
|
+
# Set the object to needing to be updated.
|
269
|
+
self.container&.should_update
|
270
|
+
end
|
271
|
+
|
272
|
+
|
273
|
+
# Map specific a UID to Attribute
|
274
|
+
#
|
275
|
+
# @author Tyler Morgan
|
276
|
+
#
|
277
|
+
# @param newvalue [String] The UID you want to be mapped
|
278
|
+
#
|
279
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
280
|
+
#
|
281
|
+
# @return [void]
|
282
|
+
def uid=(newvalue)
|
283
|
+
|
284
|
+
# Data Check
|
285
|
+
raise JSS::InvalidDataError, "uid must be either an integer or a string." unless (newvalue.is_a? Integer || newvalue.is_a?(String))
|
286
|
+
|
287
|
+
# Update Value
|
288
|
+
@uid = newvalue
|
289
|
+
|
290
|
+
# Set the object to needing to be updated.
|
291
|
+
self.container&.should_update
|
292
|
+
end
|
293
|
+
|
294
|
+
|
295
|
+
# Specify a specific forest within Active Directory
|
296
|
+
#
|
297
|
+
# @author Tyler Morgan
|
298
|
+
#
|
299
|
+
# @param newvalue [String] The forest you want to specify
|
300
|
+
#
|
301
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
302
|
+
#
|
303
|
+
# @return [void]
|
304
|
+
def forest=(newvalue)
|
305
|
+
|
306
|
+
# Data Check
|
307
|
+
raise JSS::InvalidDataError, "forest must be a string." unless newvalue.is_a? String
|
308
|
+
|
309
|
+
# Update Value
|
310
|
+
@forest = newvalue
|
311
|
+
|
312
|
+
# Set the object to needing to be updated.
|
313
|
+
self.container&.should_update
|
314
|
+
end
|
315
|
+
|
316
|
+
# Map specific a User's GID to Attribute
|
317
|
+
#
|
318
|
+
# @author Tyler Morgan
|
319
|
+
#
|
320
|
+
# @param newvalue [String] The User's GID you want to be mapped
|
321
|
+
#
|
322
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
323
|
+
#
|
324
|
+
# @return [void]
|
325
|
+
def user_gid=(newvalue)
|
326
|
+
|
327
|
+
# Data Check
|
328
|
+
raise JSS::InvalidDataError, "user_gid must be either an integer or a string." unless (newvalue.is_a? Integer || newvalue.is_a?(String))
|
329
|
+
|
330
|
+
# Update Value
|
331
|
+
@user_gid = newvalue
|
332
|
+
|
333
|
+
# Set the object to needing to be updated.
|
334
|
+
self.container&.should_update
|
335
|
+
end
|
336
|
+
|
337
|
+
|
338
|
+
# Map specific a GID to Attribute
|
339
|
+
#
|
340
|
+
# @author Tyler Morgan
|
341
|
+
#
|
342
|
+
# @param newvalue [String] The GID you want to be mapped
|
343
|
+
#
|
344
|
+
# @raise [JSS::InvalidDataError] If the new value is not a String
|
345
|
+
#
|
346
|
+
# @return [void]
|
347
|
+
def gid=(newvalue)
|
348
|
+
|
349
|
+
# Data Check
|
350
|
+
raise JSS::InvalidDataError, "gid must be either an integer or a string." unless (newvalue.is_a? Integer || newvalue.is_a?(String))
|
351
|
+
|
352
|
+
# Update Value
|
353
|
+
@gid = newvalue
|
354
|
+
|
355
|
+
# Set the object to needing to be updated.
|
356
|
+
self.container&.should_update
|
357
|
+
end
|
358
|
+
|
359
|
+
|
360
|
+
# Will this computer be possibly connecting to multiple domains
|
361
|
+
#
|
362
|
+
# @author Tyler Morgan
|
363
|
+
#
|
364
|
+
# @param newvalue [Bool]
|
365
|
+
#
|
366
|
+
# @raise [JSS::InvalidDataError] If the provided value is not a Bool.
|
367
|
+
#
|
368
|
+
# @return [void]
|
369
|
+
def multiple_domains=(newvalue)
|
370
|
+
|
371
|
+
# Data Check
|
372
|
+
raise JSS::InvalidDataError, "multiple_domains must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a?(FalseClass)
|
373
|
+
|
374
|
+
# Update Value
|
375
|
+
@multiple_domains = newvalue
|
376
|
+
|
377
|
+
# Set the object to needing to be updated.
|
378
|
+
self.container&.should_update
|
379
|
+
end
|
380
|
+
|
381
|
+
|
382
|
+
# What domain server should be highest priority
|
383
|
+
#
|
384
|
+
# @author Tyler Morgan
|
385
|
+
#
|
386
|
+
# @param newvalue [String]
|
387
|
+
#
|
388
|
+
# @raise [JSS::InvalidDataError] If the provided value is not a String.
|
389
|
+
#
|
390
|
+
# @return [void]
|
391
|
+
def preferred_domain=(newvalue)
|
392
|
+
|
393
|
+
# Data Check
|
394
|
+
raise JSS::InvalidDataError, "preferred_domain must be a string." unless newvalue.is_a? String
|
395
|
+
|
396
|
+
# Update Value
|
397
|
+
@preferred_domain = newvalue
|
398
|
+
|
399
|
+
# Set the object to needing to be updated.
|
400
|
+
self.container&.should_update
|
401
|
+
end
|
402
|
+
|
403
|
+
|
404
|
+
# The AD group which can be considered administrators of a device.
|
405
|
+
#
|
406
|
+
# @author Tyler Morgan
|
407
|
+
#
|
408
|
+
# @param newvalue [Array <String>]
|
409
|
+
#
|
410
|
+
# @raise [JSS::InvalidDataError] If the provided value is not an Array.
|
411
|
+
#
|
412
|
+
# @return [void]
|
413
|
+
def admin_groups=(newvalue)
|
414
|
+
|
415
|
+
# Data Check
|
416
|
+
raise JSS::InvalidDataError, "admin_groups must be either a string or an array of strings." unless (newvalue.is_a? String || newvalue.is_a?(Array))
|
417
|
+
|
418
|
+
# Update Value
|
419
|
+
if newvalue.is_a? Array
|
420
|
+
@admin_groups = newvalue.join ","
|
421
|
+
else
|
422
|
+
@admin_groups = newvalue
|
423
|
+
end
|
424
|
+
|
425
|
+
# Set the object to needing to be updated.
|
426
|
+
self.container&.should_update
|
427
|
+
end
|
428
|
+
|
429
|
+
|
430
|
+
# Add a specific admin group to the admin_groups
|
431
|
+
#
|
432
|
+
# @author Tyler Morgan
|
433
|
+
#
|
434
|
+
# @param newvalue [String] The admin group name you want to add to the admin group list
|
435
|
+
#
|
436
|
+
# @raise [JSS::InvalidDataError] If the value provided is not a String
|
437
|
+
# @raise [JSS::InvalidDataError] If the group provided is not in the admin_group array
|
438
|
+
#
|
439
|
+
# @return [Array <String>] An array of all the admin groups currently set.
|
440
|
+
def add_admin_group(value)
|
441
|
+
|
442
|
+
raise JSS::InvalidDataError, "Admin group must be a string." unless value.is_a? String
|
443
|
+
raise JSS::InvalidDataError, "Group \"#{value}\" already is in the admin groups." unless !@admin_groups.include? value
|
444
|
+
|
445
|
+
@admin_groups << value
|
446
|
+
# Set the object to needing to be updated.
|
447
|
+
self.container&.should_update
|
448
|
+
|
449
|
+
return @admin_groups
|
450
|
+
end
|
451
|
+
|
452
|
+
|
453
|
+
# Remove a specific admin group from the admin_groups
|
454
|
+
#
|
455
|
+
# @author Tyler Morgan
|
456
|
+
#
|
457
|
+
# @param newvalue [String] The admin group name you want to remove from the admin groups.
|
458
|
+
#
|
459
|
+
# @raise [JSS::InvalidDataError] If the value provided is not a String
|
460
|
+
# @raise [JSS::InvalidDataError] If the group provided is not in the admin_group array
|
461
|
+
#
|
462
|
+
# @return [Array <String>] An array of all the admin groups currently set.
|
463
|
+
def remove_admin_group(value)
|
464
|
+
|
465
|
+
raise JSS::InvalidDataError, "Admin group being removed must be a string." unless value.is_a? String
|
466
|
+
raise JSS::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_groups.include? value
|
467
|
+
|
468
|
+
@admin_groups.delete value
|
469
|
+
# Set the object to needing to be updated.
|
470
|
+
self.container&.should_update
|
471
|
+
|
472
|
+
return @admin_groups
|
473
|
+
end
|
474
|
+
|
475
|
+
|
476
|
+
# Return a REXML Element containing the current state of the DirectoryBindingType
|
477
|
+
# object for adding into the XML of the container.
|
478
|
+
#
|
479
|
+
# @author Tyler Morgan
|
480
|
+
#
|
481
|
+
# @return [REXML::Element]
|
482
|
+
def type_setting_xml
|
483
|
+
type_setting = REXML::Element.new "active_directory"
|
484
|
+
type_setting.add_element("cache_last_user").text = @cache_last_user
|
485
|
+
type_setting.add_element("require_confirmation").text = @require_confirmation
|
486
|
+
type_setting.add_element("local_home").text = @local_home
|
487
|
+
type_setting.add_element("use_unc_path").text = @use_unc_path
|
488
|
+
type_setting.add_element("mount_style").text = @mount_style.downcase
|
489
|
+
type_setting.add_element("default_shell").text = @default_shell
|
490
|
+
type_setting.add_element("uid").text = @uid
|
491
|
+
type_setting.add_element("user_gid").text = @user_gid
|
492
|
+
type_setting.add_element("gid").text = @gid
|
493
|
+
type_setting.add_element("multiple_domains").text = @multiple_domains
|
494
|
+
type_setting.add_element("preferred_domain").text = @preferred_domain
|
495
|
+
type_setting.add_element("admin_groups").text = @admin_groups.join(',').to_s unless @admin_groups.nil?
|
496
|
+
type_setting.add_element("forest").text = @forest.to_s
|
497
|
+
|
498
|
+
return type_setting
|
499
|
+
end
|
500
|
+
end
|
501
|
+
end
|
502
|
+
end
|