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