ruby-jss 0.10.1 → 0.10.2a4
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/lib/jss/api_connection.rb +38 -19
- data/lib/jss/api_object/advanced_search.rb +5 -1
- data/lib/jss/api_object/computer.rb +315 -291
- data/lib/jss/api_object/computer_invitation.rb +5 -3
- data/lib/jss/api_object/ebook.rb +5 -0
- data/lib/jss/api_object/group/computer_group.rb +4 -0
- data/lib/jss/api_object/group/mobile_device_group.rb +4 -1
- data/lib/jss/api_object/group.rb +6 -1
- data/lib/jss/api_object/mac_application.rb +5 -0
- data/lib/jss/api_object/mdm.rb +1268 -0
- data/lib/jss/api_object/mobile_device.rb +56 -335
- data/lib/jss/api_object/mobile_device_application.rb +6 -0
- data/lib/jss/api_object/mobile_device_configuration_profile.rb +36 -0
- data/lib/jss/api_object/osx_configuration_profile.rb +115 -151
- data/lib/jss/api_object/patch.rb +38 -0
- data/lib/jss/api_object/patch_policy.rb +38 -0
- data/lib/jss/api_object/peripheral.rb +5 -7
- data/lib/jss/api_object/policy.rb +5 -0
- data/lib/jss/api_object/restricted_software.rb +5 -0
- data/lib/jss/api_object/scopable/scope.rb +367 -411
- data/lib/jss/api_object/self_servable.rb +15 -4
- data/lib/jss/api_object/sitable.rb +197 -0
- data/lib/jss/api_object/site.rb +45 -76
- data/lib/jss/api_object/user.rb +6 -2
- data/lib/jss/api_object.rb +74 -4
- data/lib/jss/utility.rb +21 -0
- data/lib/jss/version.rb +1 -1
- data/lib/jss.rb +4 -0
- metadata +8 -4
@@ -1,141 +1,122 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
1
|
+
# Copyright 2017 Pixar
|
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
|
+
#
|
27
27
|
module JSS
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
#####################################
|
40
|
-
|
41
|
-
###
|
42
|
-
### An OS X Configuration Profile in the JSS.
|
43
|
-
###
|
44
|
-
### Note that the profile payloads and the profile UUID cannot be edited or updated with this via this class.
|
45
|
-
### Use the web UI.
|
46
|
-
###
|
47
|
-
### @see JSS::APIObject
|
48
|
-
###
|
29
|
+
# Classes
|
30
|
+
###################################
|
31
|
+
|
32
|
+
# An OS X Configuration Profile in the JSS.
|
33
|
+
#
|
34
|
+
# Note that the profile payloads and the profile UUID cannot be edited or updated with this via this class.
|
35
|
+
# Use the web UI.
|
36
|
+
#
|
37
|
+
# @see JSS::APIObject
|
38
|
+
#
|
49
39
|
class OSXConfigurationProfile < JSS::APIObject
|
50
40
|
|
51
|
-
|
52
|
-
|
53
|
-
#####################################
|
41
|
+
# Mix-Ins
|
42
|
+
###################################
|
54
43
|
include JSS::Updatable
|
55
44
|
include JSS::Scopable
|
56
45
|
include JSS::SelfServable
|
46
|
+
include JSS::Categorizable
|
47
|
+
include JSS::Sitable
|
57
48
|
|
58
|
-
|
59
|
-
|
60
|
-
#####################################
|
61
|
-
|
62
|
-
#####################################
|
63
|
-
### Class Methods
|
64
|
-
#####################################
|
49
|
+
# Class Constants
|
50
|
+
###################################
|
65
51
|
|
66
|
-
|
67
|
-
|
68
|
-
#####################################
|
52
|
+
# The base for REST resources of this class
|
53
|
+
RSRC_BASE = 'osxconfigurationprofiles'.freeze
|
69
54
|
|
70
|
-
|
71
|
-
RSRC_BASE = "osxconfigurationprofiles"
|
72
|
-
|
73
|
-
### the hash key used for the JSON list output of all objects in the JSS
|
55
|
+
# the hash key used for the JSON list output of all objects in the JSS
|
74
56
|
RSRC_LIST_KEY = :os_x_configuration_profiles
|
75
57
|
|
76
|
-
|
77
|
-
|
58
|
+
# The hash key used for the JSON object output.
|
59
|
+
# It's also used in various error messages
|
78
60
|
RSRC_OBJECT_KEY = :os_x_configuration_profile
|
79
61
|
|
80
|
-
|
81
|
-
VALID_DATA_KEYS = [
|
62
|
+
# these keys, as well as :id and :name, are present in valid API JSON data for this class
|
63
|
+
VALID_DATA_KEYS = %i[distribution_method scope redeploy_on_update].freeze
|
82
64
|
|
83
|
-
|
65
|
+
# Our scopes deal with computers
|
84
66
|
SCOPE_TARGET_KEY = :computers
|
85
67
|
|
86
|
-
|
68
|
+
# Our SelfService happens on OSX
|
87
69
|
SELF_SERVICE_TARGET = :osx
|
88
70
|
|
89
|
-
|
71
|
+
# Our SelfService deploys profiles
|
90
72
|
SELF_SERVICE_PAYLOAD = :profile
|
91
73
|
|
92
|
-
|
93
|
-
DISTRIBUTION_METHODS = [
|
74
|
+
# The possible values for the :distribution_method
|
75
|
+
DISTRIBUTION_METHODS = ['Install Automatically', 'Make Available in Self Service'].freeze
|
94
76
|
|
95
|
-
SELF_SERVICE_DIST_METHOD =
|
77
|
+
SELF_SERVICE_DIST_METHOD = 'Make Available in Self Service'.freeze
|
96
78
|
|
97
|
-
|
98
|
-
LEVELS = [
|
79
|
+
# The possible values for :level
|
80
|
+
LEVELS = %w[user computer].freeze
|
99
81
|
|
100
82
|
# the object type for this object in
|
101
83
|
# the object history table.
|
102
84
|
# See {APIObject#add_object_history_entry}
|
103
85
|
OBJECT_HISTORY_OBJECT_TYPE = 4
|
104
86
|
|
105
|
-
|
106
|
-
|
107
|
-
|
87
|
+
# Where is the Site data in the API JSON?
|
88
|
+
SITE_SUBSET = :general
|
89
|
+
|
90
|
+
# Attributes
|
91
|
+
###################################
|
108
92
|
|
109
|
-
|
93
|
+
# @return [String] the description of this profile
|
110
94
|
attr_reader :description
|
111
95
|
|
112
|
-
|
96
|
+
# @return [String] the distribution_method of this profile
|
113
97
|
attr_reader :distribution_method
|
114
98
|
|
115
|
-
|
99
|
+
# @return [Boolean] can the user remove this profile
|
116
100
|
attr_reader :user_removable
|
117
101
|
|
118
|
-
|
102
|
+
# @return [String] the level (user/computer) of this profile
|
119
103
|
attr_reader :level
|
120
104
|
|
121
|
-
|
105
|
+
# @return [String] the uuid of this profile. NOT Updatable
|
122
106
|
attr_reader :uuid
|
123
107
|
|
124
|
-
|
108
|
+
# @return [Boolean] Should this profile be redeployed when an inventory update happens?
|
125
109
|
attr_reader :redeploy_on_update
|
126
110
|
|
127
|
-
|
111
|
+
# @return [String] the plist containing the payloads for this profile. NOT Updatable
|
128
112
|
attr_reader :payloads
|
129
113
|
|
130
|
-
|
131
|
-
|
132
|
-
#####################################
|
133
|
-
|
134
|
-
###
|
135
|
-
### See JSS::APIObject#initialize
|
136
|
-
###
|
137
|
-
def initialize (args = {})
|
114
|
+
# Constructor
|
115
|
+
###################################
|
138
116
|
|
117
|
+
# See JSS::APIObject#initialize
|
118
|
+
#
|
119
|
+
def initialize(args = {})
|
139
120
|
super
|
140
121
|
|
141
122
|
@description = @main_subset[:description]
|
@@ -147,100 +128,82 @@ module JSS
|
|
147
128
|
@payloads = @main_subset[:payloads]
|
148
129
|
end
|
149
130
|
|
150
|
-
|
151
|
-
|
152
|
-
#####################################
|
131
|
+
# Public Instance Methods
|
132
|
+
###################################
|
153
133
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
def description= (new_val)
|
134
|
+
# @param new_val[String] the new discription
|
135
|
+
#
|
136
|
+
# @return [void]
|
137
|
+
#
|
138
|
+
def description=(new_val)
|
160
139
|
return nil if @self_service_description == new_val
|
161
140
|
@description = new_val.strip!
|
162
141
|
@need_to_update = true
|
163
|
-
end
|
164
|
-
|
142
|
+
end # @param new_val[String] how should this be distributed to clients?
|
165
143
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
###
|
171
|
-
def distribution_method= (new_val)
|
144
|
+
#
|
145
|
+
# @return [void]
|
146
|
+
#
|
147
|
+
def distribution_method=(new_val)
|
172
148
|
return nil if @distribution_method == new_val
|
173
149
|
raise JSS::InvalidDataError, "New value must be one of '#{DISTRIBUTION_METHODS.join("' '")}'" unless DISTRIBUTION_METHODS.include? new_val
|
174
150
|
@distribution_method = new_val
|
175
151
|
@need_to_update = true
|
176
152
|
end
|
177
153
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
def user_removable= (new_val)
|
154
|
+
# @param new_val[Boolean] should the user be able to remove this?
|
155
|
+
#
|
156
|
+
# @return [void]
|
157
|
+
#
|
158
|
+
def user_removable=(new_val)
|
184
159
|
return nil if @self_service_feature_on_main_page == new_val
|
185
160
|
raise JSS::InvalidDataError, "Distribution method must be '#{SELF_SERVICE_DIST_METHOD}' to let the user remove it." unless in_self_service?
|
186
|
-
raise JSS::InvalidDataError,
|
161
|
+
raise JSS::InvalidDataError, 'New value must be true or false' unless JSS::TRUE_FALSE.include? new_val
|
187
162
|
@user_removable = new_val
|
188
163
|
@need_to_update = true
|
189
164
|
end
|
190
165
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
def level= (new_val)
|
166
|
+
# @param new_val[String] the new level for this profile (user/computer)
|
167
|
+
#
|
168
|
+
# @return [void]
|
169
|
+
#
|
170
|
+
def level=(new_val)
|
197
171
|
return nil if @level == new_val
|
198
172
|
raise JSS::InvalidDataError, "New value must be one of '#{LEVELS.join("' '")}'" unless LEVELS.include? new_val
|
199
173
|
@level = new_val
|
200
174
|
@need_to_update = true
|
201
|
-
end
|
202
|
-
|
175
|
+
end # @return [Boolean] is this profile available in Self Service?
|
203
176
|
|
204
|
-
|
205
|
-
### @return [Boolean] is this profile available in Self Service?
|
206
|
-
###
|
177
|
+
#
|
207
178
|
def in_self_service?
|
208
179
|
@distribution_method == SELF_SERVICE_DIST_METHOD
|
209
|
-
end
|
210
|
-
|
180
|
+
end # @return [Boolean] is this profile removable by the user?
|
211
181
|
|
212
|
-
|
213
|
-
### @return [Boolean] is this profile removable by the user?
|
214
|
-
###
|
182
|
+
#
|
215
183
|
def user_removable?
|
216
184
|
@user_removable
|
217
|
-
end
|
218
|
-
|
185
|
+
end # @return [Hash] The payload plist parsed into a Ruby hash
|
219
186
|
|
220
|
-
|
221
|
-
### @return [Hash] The payload plist parsed into a Ruby hash
|
222
|
-
###
|
187
|
+
#
|
223
188
|
def parsed_payloads
|
224
189
|
Plist.parse_xml @payloads
|
225
190
|
end
|
226
191
|
|
227
|
-
|
228
|
-
|
229
|
-
###
|
192
|
+
# @return [Array<Hash>] the individual payloads from the payload Plist
|
193
|
+
#
|
230
194
|
def payload_content
|
231
195
|
parsed_payloads['PayloadContent']
|
232
196
|
end
|
233
197
|
|
234
|
-
|
235
|
-
|
236
|
-
###
|
198
|
+
# @return [Array<String>] the PayloadType of each payload (e.g. com.apple.caldav.account)
|
199
|
+
#
|
237
200
|
def payload_types
|
238
|
-
payload_content.map{|p| p['PayloadType'] }
|
201
|
+
payload_content.map { |p| p['PayloadType'] }
|
239
202
|
end
|
240
203
|
|
241
|
-
|
242
|
-
|
243
|
-
|
204
|
+
###################################
|
205
|
+
# Private Instance Methods
|
206
|
+
###################################
|
244
207
|
private
|
245
208
|
|
246
209
|
def rest_xml
|
@@ -255,9 +218,10 @@ module JSS
|
|
255
218
|
gen.add_element('redeploy_on_update').text = @redeploy_on_update
|
256
219
|
|
257
220
|
obj << @scope.scope_xml
|
258
|
-
|
259
|
-
|
260
|
-
|
221
|
+
add_self_service_xml doc
|
222
|
+
add_category_to_xml doc
|
223
|
+
add_site_to_xml doc
|
224
|
+
doc.to_s
|
261
225
|
end
|
262
226
|
|
263
227
|
end # class OSXConfigurationProfile
|
@@ -0,0 +1,38 @@
|
|
1
|
+
### Copyright 2017 Pixar
|
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
|
+
###
|
27
|
+
module JSS
|
28
|
+
|
29
|
+
# This is a stub - Patch data in the API is still borked.
|
30
|
+
# Waiting for fixes from Jamf.
|
31
|
+
#
|
32
|
+
# @see JSS::APIObject
|
33
|
+
#
|
34
|
+
class Patch < JSS::APIObject
|
35
|
+
|
36
|
+
end # class Patch
|
37
|
+
|
38
|
+
end # module JSS
|
@@ -0,0 +1,38 @@
|
|
1
|
+
### Copyright 2017 Pixar
|
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
|
+
###
|
27
|
+
module JSS
|
28
|
+
|
29
|
+
# This is a stub - Patch Policy data in the API is still borked.
|
30
|
+
# Waiting for fixes from Jamf.
|
31
|
+
#
|
32
|
+
# @see JSS::APIObject
|
33
|
+
#
|
34
|
+
class PatchPolicy < JSS::APIObject
|
35
|
+
|
36
|
+
end # class PatchPolicy
|
37
|
+
|
38
|
+
end # module JSS
|
@@ -51,16 +51,10 @@ module JSS
|
|
51
51
|
|
52
52
|
include JSS::Creatable
|
53
53
|
include JSS::Updatable
|
54
|
-
|
55
|
-
### periphs have a purchasing subset
|
56
54
|
include JSS::Purchasable
|
57
|
-
|
58
|
-
### periphs have a location subset, which will be
|
59
|
-
### stored in primary attributes.
|
60
55
|
include JSS::Locatable
|
61
|
-
|
62
|
-
### periphs can take uploaded files.
|
63
56
|
include JSS::Uploadable
|
57
|
+
include JSS::Sitable
|
64
58
|
|
65
59
|
#####################################
|
66
60
|
### Class Methods
|
@@ -88,6 +82,9 @@ module JSS
|
|
88
82
|
# See {APIObject#add_object_history_entry}
|
89
83
|
OBJECT_HISTORY_OBJECT_TYPE = 8
|
90
84
|
|
85
|
+
# Where is the Site data in the API JSON?
|
86
|
+
SITE_SUBSET = :general
|
87
|
+
|
91
88
|
#####################################
|
92
89
|
### Class Variables
|
93
90
|
#####################################
|
@@ -316,6 +313,7 @@ module JSS
|
|
316
313
|
if has_purchasing?
|
317
314
|
periph << purchasing_xml
|
318
315
|
end
|
316
|
+
add_site_to_xml doc
|
319
317
|
|
320
318
|
return doc.to_s
|
321
319
|
end # rest xml
|
@@ -77,6 +77,7 @@ module JSS
|
|
77
77
|
include JSS::Uploadable
|
78
78
|
include JSS::SelfServable
|
79
79
|
include JSS::Categorizable
|
80
|
+
include JSS::Sitable
|
80
81
|
|
81
82
|
#####################################
|
82
83
|
### Class Methods
|
@@ -249,6 +250,9 @@ module JSS
|
|
249
250
|
# See {APIObject#add_object_history_entry}
|
250
251
|
OBJECT_HISTORY_OBJECT_TYPE = 3
|
251
252
|
|
253
|
+
# Where is the Site data in the API JSON?
|
254
|
+
SITE_SUBSET = :general
|
255
|
+
|
252
256
|
######################
|
253
257
|
### Attributes
|
254
258
|
######################
|
@@ -1360,6 +1364,7 @@ module JSS
|
|
1360
1364
|
end
|
1361
1365
|
|
1362
1366
|
add_self_service_xml doc
|
1367
|
+
add_site_xml doc
|
1363
1368
|
|
1364
1369
|
doc.to_s
|
1365
1370
|
end
|
@@ -11,6 +11,7 @@ module JSS
|
|
11
11
|
include JSS::Updatable
|
12
12
|
include JSS::Creatable
|
13
13
|
include JSS::Scopable
|
14
|
+
include JSS::Sitable
|
14
15
|
|
15
16
|
# Class Constants
|
16
17
|
#####################################
|
@@ -36,6 +37,9 @@ module JSS
|
|
36
37
|
# See {APIObject#add_object_history_entry}
|
37
38
|
OBJECT_HISTORY_OBJECT_TYPE = 5
|
38
39
|
|
40
|
+
# Where is the Site data in the API JSON?
|
41
|
+
SITE_SUBSET = :general
|
42
|
+
|
39
43
|
# Attributes
|
40
44
|
#####################################
|
41
45
|
|
@@ -162,6 +166,7 @@ module JSS
|
|
162
166
|
site.add_element('name').text = @site
|
163
167
|
|
164
168
|
obj << @scope.scope_xml
|
169
|
+
add_self_service_xml doc
|
165
170
|
doc.to_s
|
166
171
|
end # rest_xml
|
167
172
|
|