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
@@ -198,7 +198,7 @@ module JSS
|
|
198
198
|
|
199
199
|
if cat.is_a? String
|
200
200
|
@category_name = cat
|
201
|
-
@category_id = JSS::Category.category_id_from_name @category_name
|
201
|
+
@category_id = JSS::Category.category_id_from_name @category_name, api: @api
|
202
202
|
else
|
203
203
|
@category_name = cat[:name]
|
204
204
|
@category_id = cat[:id]
|
@@ -529,9 +529,12 @@ module JSS
|
|
529
529
|
# @return [Time] when was it added to the JSS
|
530
530
|
attr_reader :initial_entry_date
|
531
531
|
|
532
|
-
# @return [IPAddr] the last known IP address
|
532
|
+
# @return [IPAddr] the last known IP address from the server's perspective
|
533
533
|
attr_reader :ip_address
|
534
534
|
|
535
|
+
# @return [IPAddr] the last known IP address from the client's perspecive
|
536
|
+
attr_reader :reported_ip_address
|
537
|
+
|
535
538
|
# @return [Boolean]
|
536
539
|
attr_reader :itunes_store_account_is_active
|
537
540
|
|
@@ -784,6 +787,7 @@ module JSS
|
|
784
787
|
@initial_entry_date = JSS.epoch_to_time @init_data[:general][:initial_entry_date_epoch]
|
785
788
|
@last_enrolled = JSS.epoch_to_time @init_data[:general][:last_enrolled_date_epoch]
|
786
789
|
@ip_address = @init_data[:general][:ip_address]
|
790
|
+
@reported_ip_address = @init_data[:general][:last_reported_ip]
|
787
791
|
@itunes_store_account_is_active = @init_data[:general][:itunes_store_account_is_active]
|
788
792
|
@jamf_version = @init_data[:general][:jamf_version]
|
789
793
|
@last_contact_time = JSS.epoch_to_time @init_data[:general][:last_contact_time_epoch]
|
@@ -23,7 +23,6 @@
|
|
23
23
|
#
|
24
24
|
#
|
25
25
|
|
26
|
-
#
|
27
26
|
module JSS
|
28
27
|
|
29
28
|
# Classes
|
@@ -68,7 +67,6 @@ module JSS
|
|
68
67
|
# How is the category stored in the API data?
|
69
68
|
CATEGORY_DATA_TYPE = Hash
|
70
69
|
|
71
|
-
|
72
70
|
# Attributes
|
73
71
|
###################################
|
74
72
|
|
@@ -125,12 +123,42 @@ module JSS
|
|
125
123
|
parsed_payloads['PayloadContent']
|
126
124
|
end
|
127
125
|
|
126
|
+
# @param new_content [Array<Hash>] replace the payload content entirely.
|
127
|
+
#
|
128
|
+
# The 'payload' of a config profile is an XML Plist. The top-level key
|
129
|
+
# of that plist 'PayloadContent' contains an Array of Dicts, each one being
|
130
|
+
# a part of the payload for the profile.
|
131
|
+
#
|
132
|
+
# When replacing the PayloadContent Array, using this method, provide a
|
133
|
+
# *ruby* Array full of *ruby* hashes, and they will be converted to a
|
134
|
+
# Plist and embedded into the API XML appropriately.
|
135
|
+
#
|
136
|
+
# WARNING: This is experimental! Editing the Plist Payload of a Config
|
137
|
+
# profile may break the profile. Make sure you test on a fake profile
|
138
|
+
# before using this method in production.
|
139
|
+
#
|
140
|
+
# @return [void]
|
141
|
+
#
|
142
|
+
def payload_content=(new_content)
|
143
|
+
payload_plist_data = parsed_payloads
|
144
|
+
payload_plist_data['PayloadContent'] = new_content
|
145
|
+
@payloads = payload_plist_data.to_plist
|
146
|
+
@need_to_update = true
|
147
|
+
@update_payloads = true
|
148
|
+
end
|
149
|
+
|
128
150
|
# @return [Array<String>] the PayloadType of each payload (e.g. com.apple.caldav.account)
|
129
151
|
#
|
130
152
|
def payload_types
|
131
153
|
payload_content.map { |p| p['PayloadType'] }
|
132
154
|
end
|
133
155
|
|
156
|
+
# clear flag after updating
|
157
|
+
def update
|
158
|
+
super
|
159
|
+
@update_payloads = nil
|
160
|
+
end
|
161
|
+
|
134
162
|
# Private Instance Methods
|
135
163
|
###################################
|
136
164
|
private
|
@@ -142,7 +170,10 @@ module JSS
|
|
142
170
|
gen = obj.add_element('general')
|
143
171
|
gen.add_element('description').text = @description
|
144
172
|
gen.add_element('redeploy_on_update').text = @redeploy_on_update
|
145
|
-
|
173
|
+
if @update_payloads
|
174
|
+
payloads_plist_xml = JSS.escape_xml(@payloads.gsub(/^\t*/, '').gsub(">\n", '>'))
|
175
|
+
gen.add_element('payloads').text = payloads_plist_xml
|
176
|
+
end
|
146
177
|
obj << @scope.scope_xml
|
147
178
|
add_self_service_xml doc
|
148
179
|
add_category_to_xml doc
|
@@ -0,0 +1,273 @@
|
|
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 Variables
|
29
|
+
#####################################
|
30
|
+
|
31
|
+
# Module Methods
|
32
|
+
#####################################
|
33
|
+
|
34
|
+
# Classes
|
35
|
+
#####################################
|
36
|
+
|
37
|
+
# A Directory Binding object in the JSS
|
38
|
+
# These are rather complex objects, and contain settings specific to the directory object's type.
|
39
|
+
#
|
40
|
+
# @see JSS::APIObject
|
41
|
+
# @see JSS::DirectoryBindingType
|
42
|
+
# @note "JSS::DirectoryBinding.fetch name: 'BindingName'" seems to be returning a 500 error in my test evironment. Use "JSS::DirectoryBinding.fetch 'BindingName' instead."
|
43
|
+
#
|
44
|
+
class DirectoryBinding < JSS::APIObject
|
45
|
+
|
46
|
+
# Mix-Ins
|
47
|
+
#####################################
|
48
|
+
include JSS::Creatable
|
49
|
+
include JSS::Updatable
|
50
|
+
include JSS::DirectoryBindingType
|
51
|
+
|
52
|
+
# Class Methods
|
53
|
+
#####################################
|
54
|
+
|
55
|
+
# Class Constants
|
56
|
+
#####################################
|
57
|
+
|
58
|
+
#! You CAN update this
|
59
|
+
DIRECTORY_BINDING_TYPE = {
|
60
|
+
open_directory: "Open Directory",
|
61
|
+
active_directory: "Active Directory",
|
62
|
+
powerbroker_identity_services: "PowerBroker Identity Services",
|
63
|
+
admitmac: "ADmitMac",
|
64
|
+
centrify: "Centrify"
|
65
|
+
}.freeze
|
66
|
+
|
67
|
+
DIRECTORY_BINDING_TYPE_CLASSES = {
|
68
|
+
"Open Directory" => JSS::DirectoryBindingType::OpenDirectory,
|
69
|
+
"Active Directory" => JSS::DirectoryBindingType::ActiveDirectory,
|
70
|
+
"PowerBroker Identity Services" => JSS::DirectoryBindingType::PowerBroker,
|
71
|
+
"ADmitMac" => JSS::DirectoryBindingType::ADmitMac,
|
72
|
+
"Centrify" => JSS::DirectoryBindingType::Centrify
|
73
|
+
}
|
74
|
+
|
75
|
+
# The base for REST resources of this class
|
76
|
+
RSRC_BASE = 'directorybindings'.freeze
|
77
|
+
|
78
|
+
# the hash key used for the JSON list output of all objects in the JSS
|
79
|
+
RSRC_LIST_KEY = :directory_bindings
|
80
|
+
|
81
|
+
# The hash key used for the JSON object output.
|
82
|
+
# It's also used in various error messages
|
83
|
+
RSRC_OBJECT_KEY = :directory_binding
|
84
|
+
|
85
|
+
# the object type for this object in
|
86
|
+
# the object history table.
|
87
|
+
# See {APIObject#add_object_history_entry}
|
88
|
+
# OBJECT_HISTORY_OBJECT_TYPE = 41
|
89
|
+
|
90
|
+
# Attributes
|
91
|
+
#####################################
|
92
|
+
attr_reader :id
|
93
|
+
attr_reader :name
|
94
|
+
attr_reader :priority
|
95
|
+
attr_reader :domain
|
96
|
+
attr_reader :username
|
97
|
+
attr_reader :password_sha256
|
98
|
+
attr_reader :computer_ou
|
99
|
+
attr_reader :type
|
100
|
+
attr_reader :type_settings
|
101
|
+
attr_reader :password
|
102
|
+
|
103
|
+
# Constructor
|
104
|
+
# @see JSS::APIObject.initialize
|
105
|
+
# @note When creating an object with specific properties use the
|
106
|
+
# objects name and then the settings.
|
107
|
+
# Ex: Creating an Active Directory object:
|
108
|
+
# JSS::DirectoryBinding.make name: "Example Binding", username: "BindingUser", password: "SuperMonkey123", computer_ou: "computers", active_directory: { multiple_domains: false }, domain: your.domain.server
|
109
|
+
#####################################
|
110
|
+
def initialize(args = {})
|
111
|
+
super args
|
112
|
+
|
113
|
+
if self.in_jss?
|
114
|
+
@priority = @init_data[:priority]
|
115
|
+
@domain = @init_data[:domain]
|
116
|
+
@username = @init_data[:username]
|
117
|
+
@password_sha256 = @init_data[:password_sha256]
|
118
|
+
@computer_ou = @init_data[:computer_ou]
|
119
|
+
@type = @init_data[:type]
|
120
|
+
|
121
|
+
class_key = DIRECTORY_BINDING_TYPE.select { |k,v| v == @type }.map { |k,v| k }.first
|
122
|
+
self.set_type_settings (DIRECTORY_BINDING_TYPE_CLASSES[@type.to_s].new @init_data[class_key])
|
123
|
+
else
|
124
|
+
# Build
|
125
|
+
raise JSS::MissingDataError, "domain must be provided." if @init_data[:domain].nil?
|
126
|
+
raise JSS::MissingDataError, "username must be provided." if @init_data[:username].nil?
|
127
|
+
raise JSS::MissingDataError, "computer_ou must be provided." if @init_data[:computer_ou].nil?
|
128
|
+
raise JSS::MissingDataError, "password must be provided when creating a DirectoryBinding object." if @init_data[:password].nil?
|
129
|
+
raise JSS::MissingDataError, "Type must be provided, one of \":#{DIRECTORY_BINDING_TYPE.keys.join(",:")}\"." if @init_data[:type].nil?
|
130
|
+
raise JSS::InvalidDataError, "Type must be one of \":#{DIRECTORY_BINDING_TYPE.keys.join(",:")}\"." unless DIRECTORY_BINDING_TYPE.keys.include? @init_data[:type]
|
131
|
+
raise JSS::InvalidDataError, "Priority must be between 1 and 10" if !@init_data[:priority].nil? && (@init_data[:priority] <= 1 || @init_data[:priority] >= 10)
|
132
|
+
|
133
|
+
@domain = @init_data[:domain]
|
134
|
+
@username = @init_data[:username]
|
135
|
+
@computer_ou = @init_data[:computer_ou]
|
136
|
+
@type = DIRECTORY_BINDING_TYPE[@init_data[:type]]
|
137
|
+
@password = @init_data[:password]
|
138
|
+
@priority = @init_data[:priority]
|
139
|
+
|
140
|
+
@priority = 1 if @priority.nil?
|
141
|
+
|
142
|
+
|
143
|
+
class_key = DIRECTORY_BINDING_TYPE.select { |k,v| v == @type }.map { |k,v| k }.first
|
144
|
+
self.set_type_settings (DIRECTORY_BINDING_TYPE_CLASSES[@type.to_s].new @init_data[class_key])
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
|
150
|
+
# Public Instance Methods
|
151
|
+
#####################################
|
152
|
+
|
153
|
+
# The domain the device will be bound to.
|
154
|
+
#
|
155
|
+
# @author Tyler Morgan
|
156
|
+
#
|
157
|
+
# @param newvalue [String]
|
158
|
+
#
|
159
|
+
# @raise [JSS::InvalidDataError] If newvalue is not a String
|
160
|
+
#
|
161
|
+
# @return [void]
|
162
|
+
def domain=(newvalue)
|
163
|
+
raise JSS::InvalidDataError, "Domain must be a String" unless newvalue.is_a? String
|
164
|
+
|
165
|
+
@domain = newvalue.to_s
|
166
|
+
@need_to_update = true
|
167
|
+
end
|
168
|
+
|
169
|
+
|
170
|
+
# The username used to attempt to bind the device to the domain.
|
171
|
+
#
|
172
|
+
# @author Tyler Morgan
|
173
|
+
#
|
174
|
+
# @param newvalue [String]
|
175
|
+
#
|
176
|
+
# @raise [JSS::InvalidDataError] If newvalue is not a String
|
177
|
+
#
|
178
|
+
# @return [void]
|
179
|
+
def username=(newvalue)
|
180
|
+
raise JSS::InvalidDataError, "Username must be a String" unless newvalue.is_a? String
|
181
|
+
|
182
|
+
@username = newvalue
|
183
|
+
@need_to_update = true
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
# The priority the domain has over another one.
|
188
|
+
#
|
189
|
+
# @author Tyler Morgan
|
190
|
+
#
|
191
|
+
# @param newvalue [Integer]
|
192
|
+
#
|
193
|
+
# @raise [JSS::InvalidDataError] If newvalue is not an Integer
|
194
|
+
# @raise [JSS::InvalidDataError] If newvalue is not between 1 and 10
|
195
|
+
#
|
196
|
+
# @return [void]
|
197
|
+
def priority=(newvalue)
|
198
|
+
raise JSS::InvalidDataError, "Priority must be a Integer" unless newvalue.is_a? Integer
|
199
|
+
raise JSS::InvalidDataError, "Priority cannot exceed 10" unless newvalue <= 10
|
200
|
+
raise JSS::InvalidDataError, "Priority must be greater than 0" unless newvalue > 0
|
201
|
+
|
202
|
+
@priority = newvalue
|
203
|
+
@need_to_update = true
|
204
|
+
end
|
205
|
+
|
206
|
+
|
207
|
+
# The OU path the computer object is to be placed
|
208
|
+
#
|
209
|
+
# @author Tyler Morgan
|
210
|
+
#
|
211
|
+
# @param newvalue [String]
|
212
|
+
#
|
213
|
+
# @raise [JSS::InvalidDataError] If newvalue is not a String
|
214
|
+
#
|
215
|
+
# @return [void]
|
216
|
+
def computer_ou=(newvalue)
|
217
|
+
raise JSS::InvalidDataError, "Computer OU must be a String" unless newvalue.is_a? String
|
218
|
+
|
219
|
+
@computer_ou = newvalue
|
220
|
+
@need_to_update = true
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
# Sets the password used in conjunction with the username to attempt to bind
|
225
|
+
# the computer to the domain.
|
226
|
+
#
|
227
|
+
# @author Tyler Morgan
|
228
|
+
#
|
229
|
+
# @param newvalue [String]
|
230
|
+
#
|
231
|
+
# @raise [JSS::InvalidDataError] If newvalue is not a String
|
232
|
+
#
|
233
|
+
# @return [void]
|
234
|
+
def password=(newvalue)
|
235
|
+
raise JSS::InvalidDataError, "Password must be a string" unless newvalue.is_a? String
|
236
|
+
|
237
|
+
@password = newvalue
|
238
|
+
@need_to_update = true
|
239
|
+
end
|
240
|
+
|
241
|
+
# private instance methods
|
242
|
+
######################
|
243
|
+
private
|
244
|
+
|
245
|
+
# the xml formated data for adding or updating this in the JSS
|
246
|
+
#
|
247
|
+
# This method constructs a properly formatted XML document to be handled by the Jamf Pro API
|
248
|
+
#
|
249
|
+
# @author Tyler Morgan
|
250
|
+
#
|
251
|
+
# @return [String]
|
252
|
+
def rest_xml
|
253
|
+
doc = REXML::Document.new APIConnection::XML_HEADER
|
254
|
+
ns = doc.add_element RSRC_OBJECT_KEY.to_s
|
255
|
+
ns.add_element('id').text = @id.to_s
|
256
|
+
ns.add_element('name').text = @name
|
257
|
+
ns.add_element('priority').text = @priority.to_s
|
258
|
+
ns.add_element('domain').text = @domain.to_s
|
259
|
+
ns.add_element('username').text = @username.to_s
|
260
|
+
ns.add_element('computer_ou').text = @computer_ou.to_s
|
261
|
+
ns.add_element('type').text = @type.to_s
|
262
|
+
if !@password.nil?
|
263
|
+
ns.add_element('password').text = @password.to_s
|
264
|
+
end
|
265
|
+
|
266
|
+
ns << @type_settings.type_setting_xml
|
267
|
+
|
268
|
+
return doc.to_s
|
269
|
+
end # rest_xml
|
270
|
+
end
|
271
|
+
|
272
|
+
|
273
|
+
end
|
@@ -0,0 +1,96 @@
|
|
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
|
+
|
54
|
+
|
55
|
+
# Mix-Ins
|
56
|
+
#####################################
|
57
|
+
|
58
|
+
# Class Methods
|
59
|
+
#####################################
|
60
|
+
|
61
|
+
# Class Constants
|
62
|
+
#####################################
|
63
|
+
|
64
|
+
# The different network protocols supported.
|
65
|
+
NETWORK_PROTOCOL = {
|
66
|
+
afp: 'AFP',
|
67
|
+
smb: 'SMB'
|
68
|
+
}.freeze
|
69
|
+
|
70
|
+
# The different home folder types.
|
71
|
+
HOME_FOLDER_TYPE = {
|
72
|
+
network: 'Network',
|
73
|
+
local: 'Local',
|
74
|
+
either: 'Either',
|
75
|
+
mobile: 'Mobile'
|
76
|
+
}.freeze
|
77
|
+
|
78
|
+
# Attributes
|
79
|
+
#####################################
|
80
|
+
|
81
|
+
# This is used to properly handle updating the containing object.
|
82
|
+
attr_accessor :container
|
83
|
+
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
require 'jss/api_object/directory_binding_type/active_directory'
|
93
|
+
require 'jss/api_object/directory_binding_type/open_directory'
|
94
|
+
require 'jss/api_object/directory_binding_type/admitmac'
|
95
|
+
require 'jss/api_object/directory_binding_type/centrify'
|
96
|
+
require 'jss/api_object/directory_binding_type/powerbroker_identity_services'
|