ruby-jss 0.10.1 → 0.10.2a4
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/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
@@ -39,14 +39,14 @@ module JSS
|
|
39
39
|
# This class represents a Mobile Device stored in the JSS.
|
40
40
|
#
|
41
41
|
# ---
|
42
|
-
# ===Adding devices to the JSS
|
42
|
+
# === Adding devices to the JSS
|
43
43
|
#
|
44
44
|
# This class cannot be used to add new mobile devices to the JSS. That can only be done
|
45
45
|
# via the enrollment process. See JSS::MobileDeviceInvitation for sending
|
46
46
|
# an enrollment invite to a device.
|
47
47
|
#
|
48
48
|
# ---
|
49
|
-
# ===Editing values
|
49
|
+
# === Editing values
|
50
50
|
#
|
51
51
|
# Only a few values can be changed via the API, using these methods, q.v:
|
52
52
|
# - #asset_tag= String
|
@@ -57,24 +57,17 @@ module JSS
|
|
57
57
|
# After modfying any values, #save must be called to save changes to the JSS.
|
58
58
|
#
|
59
59
|
# ---
|
60
|
-
# ===MDM Commands
|
60
|
+
# === MDM Commands
|
61
61
|
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
# the Management Commands section of the Management tab of the Mobile Device details page in the JSS UI.
|
62
|
+
# See the {JSS::MDM} mixin module for Class and Instance methods for
|
63
|
+
# sending MDM commands to mobiledevices.
|
65
64
|
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
# - update_inventory (alias recon)
|
69
|
-
# - device_lock (aliases lock, lock_device)
|
70
|
-
# - erase_device (aliases wipe)
|
71
|
-
# - clear_passcode
|
72
|
-
# - unmanage_device (alias unmanage)
|
73
|
-
#
|
74
|
-
# Each returns true if the command as sent.
|
75
|
-
#
|
76
|
-
# @see JSS::APIObject
|
65
|
+
# To send MDM commands without fetching mobiledevice instances, use the class
|
66
|
+
# methods, which can take multiple identifiers at once.
|
77
67
|
#
|
68
|
+
# NOTE: If the {#name=} method is used to change the name of a supervized device,
|
69
|
+
# the DeviceName MDM command will be sent to the device when
|
70
|
+
# the changes are sent to the server via {#save} or {#update}
|
78
71
|
#
|
79
72
|
class MobileDevice < JSS::APIObject
|
80
73
|
|
@@ -86,6 +79,8 @@ module JSS
|
|
86
79
|
include JSS::Purchasable
|
87
80
|
include JSS::Uploadable
|
88
81
|
include JSS::Extendable
|
82
|
+
include JSS::Sitable
|
83
|
+
include JSS::MDM
|
89
84
|
|
90
85
|
extend JSS::Matchable
|
91
86
|
|
@@ -102,6 +97,9 @@ module JSS
|
|
102
97
|
# It's also used in various error messages
|
103
98
|
RSRC_OBJECT_KEY = :mobile_device
|
104
99
|
|
100
|
+
# Where is the Site data in the API JSON?
|
101
|
+
SITE_SUBSET = :general
|
102
|
+
|
105
103
|
# these keys, as well as :id and :name, are present in valid API JSON data for this class
|
106
104
|
VALID_DATA_KEYS = %i[device_name capacity tethered].freeze
|
107
105
|
|
@@ -120,66 +118,9 @@ module JSS
|
|
120
118
|
# This is the class for relevant Extension Attributes
|
121
119
|
EXT_ATTRIB_CLASS = JSS::MobileDeviceExtensionAttribute
|
122
120
|
|
123
|
-
#
|
124
|
-
|
125
|
-
|
126
|
-
# The MDM commands sendable via the api
|
127
|
-
# and alternative versions
|
128
|
-
#
|
129
|
-
MDM_COMMANDS = {
|
130
|
-
blank_push: 'BlankPush',
|
131
|
-
send_blank_push: 'BlankPush',
|
132
|
-
blank: 'BlankPush',
|
133
|
-
noop: 'BlankPush',
|
134
|
-
|
135
|
-
settings: 'Settings',
|
136
|
-
|
137
|
-
update_inventory: 'UpdateInventory',
|
138
|
-
recon: 'UpdateInventory',
|
139
|
-
|
140
|
-
device_lock: 'DeviceLock',
|
141
|
-
lock: 'DeviceLock',
|
142
|
-
lock_device: 'DeviceLock',
|
143
|
-
|
144
|
-
erase_device: 'EraseDevice',
|
145
|
-
erase: 'EraseDevice',
|
146
|
-
wipe: 'EraseDevice',
|
147
|
-
|
148
|
-
clear_passcode: 'ClearPasscode',
|
149
|
-
|
150
|
-
clear_restrictions_password: 'ClearRestrictionsPassword',
|
151
|
-
|
152
|
-
enable_data_roaming: 'SettingsEnableDataRoaming',
|
153
|
-
disable_data_roaming: 'SettingsDisableDataRoaming',
|
154
|
-
|
155
|
-
enable_voice_roaming: 'SettingsEnableVoiceRoaming',
|
156
|
-
disable_voice_roaming: 'SettingsDisableVoiceRoaming',
|
157
|
-
|
158
|
-
enable_app_analytics: 'SettingsEnableAppAnalytics',
|
159
|
-
disable_app_analytics: 'SettingsDisableAppAnalytics',
|
160
|
-
|
161
|
-
enable_diagnostic_submission: 'SettingsEnableDiagnosticSubmission',
|
162
|
-
disable_diagnostic_submission: 'SettingsDisableDiagnosticSubmission',
|
163
|
-
|
164
|
-
# wallpaper: 'Wallpaper',
|
165
|
-
|
166
|
-
device_name: 'DeviceName',
|
121
|
+
# What kind of devices are we for MDM purposes?
|
122
|
+
MDM_COMMAND_TARGET = :mobiledevices
|
167
123
|
|
168
|
-
shutdown_device: 'ShutDownDevice',
|
169
|
-
shutdown: 'ShutDownDevice',
|
170
|
-
|
171
|
-
restart_device: 'RestartDevice',
|
172
|
-
restart: 'RestartDevice',
|
173
|
-
|
174
|
-
# passcode_lock_grace_period: 'PasscodeLockGracePeriod',
|
175
|
-
|
176
|
-
unmanage_device: 'UnmanageDevice',
|
177
|
-
unmanage: 'UnmanageDevice'
|
178
|
-
|
179
|
-
}.freeze
|
180
|
-
|
181
|
-
# These MDM commands need extra data.
|
182
|
-
MDM_COMMANDS_REQUIRING_DATA = %w[DeviceLock DeviceName Wallpaper].freeze
|
183
124
|
|
184
125
|
# The History resource
|
185
126
|
HISTORY_RSRC = 'mobiledevicehistory'.freeze
|
@@ -198,101 +139,62 @@ module JSS
|
|
198
139
|
|
199
140
|
# @return [Array<String>] all mobiledevice serial_numbers
|
200
141
|
def self.all_serial_numbers(refresh = false, api: JSS.api)
|
201
|
-
all(refresh, api:
|
142
|
+
all(refresh, api: api).map { |i| i[:serial_number] }
|
202
143
|
end
|
203
144
|
|
204
145
|
# @return [Array<String>] all mobiledevice phone numbers
|
205
146
|
def self.all_phone_numbers(refresh = false, api: JSS.api)
|
206
|
-
all(refresh, api:
|
147
|
+
all(refresh, api: api).map { |i| i[:phone_number] }.reject(&:empty?)
|
207
148
|
end
|
208
149
|
|
209
150
|
# @return [Array<String>] all mobiledevice wifi mac addrs
|
210
151
|
def self.all_wifi_mac_addresses(refresh = false, api: JSS.api)
|
211
|
-
all(refresh, api:
|
152
|
+
all(refresh, api: api).map { |i| i[:wifi_mac_address] }
|
212
153
|
end
|
213
154
|
|
214
155
|
# @return [Array<String>] all mobiledevice wifi mac addrs
|
215
156
|
def self.all_mac_addresses(refresh = false, api: JSS.api)
|
216
|
-
all_wifi_mac_addresses(refresh, api:
|
157
|
+
all_wifi_mac_addresses(refresh, api: api)
|
217
158
|
end
|
218
159
|
|
219
160
|
# @return [Array<String>] all mobiledevice udids
|
220
161
|
def self.all_udids(refresh = false, api: JSS.api)
|
221
|
-
all(refresh, api:
|
162
|
+
all(refresh, api: api).map { |i| i[:udid] }
|
222
163
|
end
|
223
164
|
|
224
165
|
# @return [Array<Hash>] the list of all managed mobile devices
|
225
166
|
def self.all_managed(refresh = false, api: JSS.api)
|
226
|
-
all(refresh, api:
|
167
|
+
all(refresh, api: api).select { |d| d[:managed] }
|
227
168
|
end
|
228
169
|
|
229
170
|
# @return [Array<Hash>] the list of all unmanaged mobile devices
|
230
171
|
def self.all_unmanaged(refresh = false, api: JSS.api)
|
231
|
-
all(refresh, api:
|
172
|
+
all(refresh, api: api).reject { |d| d[:managed] }
|
173
|
+
end
|
174
|
+
|
175
|
+
# @return [Array<Hash>] the list of all supervised mobile devices
|
176
|
+
def self.all_supervised(refresh = false, api: JSS.api)
|
177
|
+
all(refresh, api: api).select { |d| d[:supervised] }
|
178
|
+
end
|
179
|
+
|
180
|
+
# @return [Array<Hash>] the list of all unsupervised mobile devices
|
181
|
+
def self.all_unsupervised(refresh = false, api: JSS.api)
|
182
|
+
all(refresh, api: api).reject { |d| d[:supervised] }
|
232
183
|
end
|
233
184
|
|
234
185
|
# @return [Array<Hash>] the list of all iPhones
|
235
186
|
def self.all_iphones(refresh = false, api: JSS.api)
|
236
|
-
all(refresh, api:
|
187
|
+
all(refresh, api: api).select { |d| d[:model].start_with? 'iPhone' }
|
237
188
|
end
|
238
189
|
|
239
190
|
# @return [Array<Hash>] the list of all iPads
|
240
191
|
def self.all_ipads(refresh = false, api: JSS.api)
|
241
|
-
all(refresh, api:
|
192
|
+
all(refresh, api: api).select { |d| d[:model].start_with? 'iPad' }
|
242
193
|
end
|
243
194
|
|
244
195
|
# @return [Array<Hash>] the list of all iPads
|
245
196
|
def self.all_apple_tvs(refresh = false, api: JSS.api)
|
246
|
-
all(refresh, api:
|
247
|
-
end
|
248
|
-
|
249
|
-
# Send an MDM command to one or more mobile devices by id or name
|
250
|
-
#
|
251
|
-
#
|
252
|
-
# @param targets[String,Integer,Array<String,Integer>]
|
253
|
-
# the name or id of the mobile devices to receive the command, or
|
254
|
-
# an array of such names or ids, or a comma-separated string
|
255
|
-
# of them.
|
256
|
-
# @param command[Symbol] the command to send, one of the keys
|
257
|
-
# of MDM_COMMANDS
|
258
|
-
#
|
259
|
-
# @param data[String] Some commands require extra data.
|
260
|
-
#
|
261
|
-
# @param api[JSS::APIConnection] the APi to query. Defaults to the
|
262
|
-
# currently active API, see {JSS::APIConnection}
|
263
|
-
#
|
264
|
-
# @return [String] The uuid of the MDM command sent, if applicable
|
265
|
-
# (blank pushes do not generate uuids)
|
266
|
-
#
|
267
|
-
def self.send_mdm_command(targets, command, data = nil, api: JSS.api)
|
268
|
-
raise JSS::NoSuchItemError, "Unknown command '#{command}'" unless MDM_COMMANDS.keys.include? command
|
269
|
-
|
270
|
-
command = MDM_COMMANDS[command]
|
271
|
-
cmd_rsrc = "#{MDM_RSRC}/#{command}"
|
272
|
-
|
273
|
-
if MDM_COMMANDS_REQUIRING_DATA.include? command
|
274
|
-
raise "MDM command '#{command}' requires additional data." unless data
|
275
|
-
cmd_rsrc << "/#{data}"
|
276
|
-
end
|
277
|
-
|
278
|
-
targets = JSS.to_s_and_a(targets.to_s)[:arrayform] unless targets.is_a? Array
|
279
|
-
|
280
|
-
# make sure its an array of ids
|
281
|
-
targets.map! do |md|
|
282
|
-
if all_ids(api: api).include? md.to_i
|
283
|
-
md.to_i
|
284
|
-
elsif all_names(api: api).include? md
|
285
|
-
map_all_ids_to(:name, api: api.invert[md])
|
286
|
-
else
|
287
|
-
raise JSS::NoSuchItemError, "No mobile device found matching '#{md}'"
|
288
|
-
end # if
|
289
|
-
end # map!
|
290
|
-
|
291
|
-
cmd_rsrc << "/id/#{targets.join ','}"
|
292
|
-
|
293
|
-
result = api.post_rsrc cmd_rsrc, nil
|
294
|
-
result =~ %r{<uuid>(.*)</uuid>}
|
295
|
-
Regexp.last_match(1)
|
197
|
+
all(refresh, api: api).select { |d| d[:model_identifier].start_with? 'AppleTV' }
|
296
198
|
end
|
297
199
|
|
298
200
|
def self.management_history(identifier, subset = nil, api: JSS.api)
|
@@ -300,12 +202,13 @@ module JSS
|
|
300
202
|
if identifier.is_a? Integer
|
301
203
|
id = identifier
|
302
204
|
else
|
303
|
-
key =
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
205
|
+
key =
|
206
|
+
case identifier
|
207
|
+
when *all_names(api: api) then :name
|
208
|
+
when *all_serial_numbers(api: api) then :serial_number
|
209
|
+
when *all_mac_addresses(api: api) then :mac_address
|
210
|
+
when *all_udids(api: api) then :udid
|
211
|
+
end
|
309
212
|
id = map_all_ids_to(key, api: api).invert[identifier]
|
310
213
|
end # if identifier.is_a? Integer
|
311
214
|
|
@@ -494,11 +397,9 @@ module JSS
|
|
494
397
|
# - :file_level_encryption_capable=>true
|
495
398
|
attr_reader :security
|
496
399
|
|
497
|
-
#####################################
|
498
400
|
# Instance Methods
|
499
401
|
#####################################
|
500
402
|
|
501
|
-
#
|
502
403
|
# @see APIObject#initialize
|
503
404
|
#
|
504
405
|
def initialize(args = {})
|
@@ -548,188 +449,16 @@ module JSS
|
|
548
449
|
@applications = @init_data[:applications]
|
549
450
|
end # initialize
|
550
451
|
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
#
|
555
|
-
# @return [String] The command uuid
|
556
|
-
#
|
557
|
-
def blank_push
|
558
|
-
self.class.send_mdm_command @id, :blank_push, api: @api
|
559
|
-
end #
|
560
|
-
|
561
|
-
# Send an update_inventory MDM command
|
562
|
-
#
|
563
|
-
# @see MobileDevice.send_mdm_command
|
564
|
-
#
|
565
|
-
# @return [String] The command uuid
|
566
|
-
#
|
567
|
-
def update_inventory
|
568
|
-
self.class.send_mdm_command @id, :update_inventory, api: @api
|
569
|
-
end
|
570
|
-
|
571
|
-
# Send a device_lock MDM command
|
572
|
-
#
|
573
|
-
# @param message[String] The message to display on the lock screen.
|
574
|
-
#
|
575
|
-
# @see MobileDevice.send_mdm_command
|
576
|
-
#
|
577
|
-
# @return [String] The command uuid
|
578
|
-
#
|
579
|
-
def device_lock(message)
|
580
|
-
self.class.send_mdm_command @id, :device_lock, message, api: @api
|
581
|
-
end
|
582
|
-
|
583
|
-
# Send an erase_device MDM command
|
584
|
-
#
|
585
|
-
# @see MobileDevice.send_mdm_command
|
586
|
-
#
|
587
|
-
# @return [String] The command uuid
|
588
|
-
#
|
589
|
-
def erase_device
|
590
|
-
self.class.send_mdm_command @id, :erase_device, api: @api
|
591
|
-
end
|
592
|
-
|
593
|
-
# Send a clear_passcode MDM command
|
594
|
-
#
|
595
|
-
# @see MobileDevice.send_mdm_command
|
596
|
-
#
|
597
|
-
# @return [String] The command uuid
|
598
|
-
#
|
599
|
-
def clear_passcode
|
600
|
-
self.class.send_mdm_command @id, :clear_passcode, api: @api
|
601
|
-
end
|
602
|
-
|
603
|
-
# Send a unmanage_device MDM command
|
604
|
-
#
|
605
|
-
# @see MobileDevice.send_mdm_command
|
606
|
-
#
|
607
|
-
# @return [String] The command uuid
|
608
|
-
#
|
609
|
-
def unmanage_device
|
610
|
-
@managed = false if self.class.send_mdm_command(@id, :unmanage_device, api: @api)
|
611
|
-
end
|
612
|
-
|
613
|
-
# Send a ClearRestrictionsPassword MDM command
|
614
|
-
#
|
615
|
-
# @see MobileDevice.send_mdm_command
|
616
|
-
#
|
617
|
-
# @return [String] The command uuid
|
618
|
-
#
|
619
|
-
def clear_restrictions_password
|
620
|
-
self.class.send_mdm_command @id, :clear_restrictions_password, api: @api
|
621
|
-
end
|
622
|
-
|
623
|
-
# Send a SettingsEnableDataRoaming MDM command
|
624
|
-
#
|
625
|
-
# @see MobileDevice.send_mdm_command
|
626
|
-
#
|
627
|
-
# @return [String] The command uuid
|
628
|
-
#
|
629
|
-
def enable_data_roaming
|
630
|
-
self.class.send_mdm_command @id, :enable_data_roaming, api: @api
|
631
|
-
end
|
632
|
-
|
633
|
-
# Send a disable_data_roaming MDM command
|
634
|
-
#
|
635
|
-
# @see MobileDevice.send_mdm_command
|
636
|
-
#
|
637
|
-
# @return [String] The command uuid
|
638
|
-
#
|
639
|
-
def disable_data_roaming
|
640
|
-
self.class.send_mdm_command @id, :disable_data_roaming, api: @api
|
641
|
-
end
|
642
|
-
|
643
|
-
# Send a enable_voice_roaming MDM command
|
644
|
-
#
|
645
|
-
# @see MobileDevice.send_mdm_command
|
646
|
-
#
|
647
|
-
# @return [String] The command uuid
|
648
|
-
#
|
649
|
-
def enable_voice_roaming
|
650
|
-
self.class.send_mdm_command @id, :enable_voice_roaming, api: @api
|
651
|
-
end
|
652
|
-
|
653
|
-
# Send a disable_voice_roaming MDM command
|
654
|
-
#
|
655
|
-
# @see MobileDevice.send_mdm_command
|
656
|
-
#
|
657
|
-
# @return [String] The command uuid
|
658
|
-
#
|
659
|
-
def disable_voice_roaming
|
660
|
-
self.class.send_mdm_command @id, :disable_voice_roaming, api: @api
|
661
|
-
end
|
662
|
-
|
663
|
-
# Send a enable_app_analytics MDM command
|
664
|
-
#
|
665
|
-
# @see MobileDevice.send_mdm_command
|
666
|
-
#
|
667
|
-
# @return [String] The command uuid
|
668
|
-
#
|
669
|
-
def enable_app_analytics
|
670
|
-
self.class.send_mdm_command @id, :enable_app_analytics, api: @api
|
671
|
-
end
|
672
|
-
|
673
|
-
# Send a disable_app_analytics MDM command
|
674
|
-
#
|
675
|
-
# @see MobileDevice.send_mdm_command
|
676
|
-
#
|
677
|
-
# @return [String] The command uuid
|
678
|
-
#
|
679
|
-
def disable_app_analytics
|
680
|
-
self.class.send_mdm_command @id, :disable_app_analytics, api: @api
|
681
|
-
end
|
682
|
-
|
683
|
-
# Send a enable_diagnostic_submission MDM command
|
684
|
-
#
|
685
|
-
# @see MobileDevice.send_mdm_command
|
686
|
-
#
|
687
|
-
# @return [String] The command uuid
|
688
|
-
#
|
689
|
-
def enable_diagnostic_submission
|
690
|
-
self.class.send_mdm_command @id, :enable_diagnostic_submission, api: @api
|
691
|
-
end
|
692
|
-
|
693
|
-
# Send a disable_diagnostic_submission MDM command
|
694
|
-
#
|
695
|
-
# @see MobileDevice.send_mdm_command
|
696
|
-
#
|
697
|
-
# @return [String] The command uuid
|
698
|
-
#
|
699
|
-
def disable_diagnostic_submission
|
700
|
-
self.class.send_mdm_command @id, :disable_diagnostic_submission, api: @api
|
701
|
-
end
|
702
|
-
|
703
|
-
# Send a device_name MDM command
|
704
|
-
#
|
705
|
-
# @param new_name[String] The name for the device
|
706
|
-
#
|
707
|
-
# @see MobileDevice.send_mdm_command
|
708
|
-
#
|
709
|
-
# @return [String] The command uuid
|
710
|
-
#
|
711
|
-
def device_name(new_name)
|
712
|
-
self.class.send_mdm_command @id, :device_name, new_name, api: @api
|
452
|
+
def name=(new_name)
|
453
|
+
super
|
454
|
+
@needs_mdm_name_change = true if managed? && supervised?
|
713
455
|
end
|
714
456
|
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
#
|
721
|
-
def shutdown
|
722
|
-
self.class.send_mdm_command @id, :shutdown, api: @api
|
723
|
-
end
|
724
|
-
|
725
|
-
# Send a restart device MDM command
|
726
|
-
#
|
727
|
-
# @see MobileDevice.send_mdm_command
|
728
|
-
#
|
729
|
-
# @return [String] The command uuid
|
730
|
-
#
|
731
|
-
def restart
|
732
|
-
self.class.send_mdm_command @id, :restart, api: @api
|
457
|
+
def update
|
458
|
+
super
|
459
|
+
return unless @needs_mdm_name_change
|
460
|
+
self.class.send_mdm_command @id, :device_name, opts: { device_name: @name }, api: @api
|
461
|
+
@needs_mdm_name_change = false
|
733
462
|
end
|
734
463
|
|
735
464
|
# The full management History data for this Mobile Device
|
@@ -924,18 +653,12 @@ module JSS
|
|
924
653
|
# Aliases
|
925
654
|
alias battery_percent battery_level
|
926
655
|
alias managed? managed
|
656
|
+
alias supervised? supervised
|
927
657
|
alias sn serial_number
|
928
658
|
alias serialnumber serial_number
|
929
659
|
|
930
|
-
|
931
|
-
|
932
|
-
alias recon update_inventory
|
933
|
-
alias lock device_lock
|
934
|
-
alias lock_device device_lock
|
935
|
-
alias erase erase_device
|
936
|
-
alias wipe erase_device
|
937
|
-
alias unmanage unmanage_device
|
938
|
-
alias make_unmanaged unmanage_device
|
660
|
+
|
661
|
+
|
939
662
|
|
940
663
|
# private methods
|
941
664
|
##############################
|
@@ -945,12 +668,10 @@ module JSS
|
|
945
668
|
def rest_xml
|
946
669
|
doc = REXML::Document.new APIConnection::XML_HEADER
|
947
670
|
md = doc.add_element self.class::RSRC_OBJECT_KEY.to_s
|
948
|
-
|
949
671
|
md << ext_attr_xml
|
950
|
-
|
951
672
|
md << location_xml if has_location?
|
952
673
|
md << purchasing_xml if has_purchasing?
|
953
|
-
|
674
|
+
add_site_to_xml doc
|
954
675
|
doc.to_s
|
955
676
|
end
|
956
677
|
|
@@ -48,6 +48,8 @@ module JSS
|
|
48
48
|
include JSS::Categorizable
|
49
49
|
include JSS::Uploadable
|
50
50
|
include JSS::VPPable
|
51
|
+
include JSS::Sitable
|
52
|
+
|
51
53
|
|
52
54
|
# Class Methods
|
53
55
|
#####################################
|
@@ -93,6 +95,9 @@ module JSS
|
|
93
95
|
# See {APIObject#add_object_history_entry}
|
94
96
|
OBJECT_HISTORY_OBJECT_TYPE = 23
|
95
97
|
|
98
|
+
# Where is the Site data in the API JSON?
|
99
|
+
SITE_SUBSET = :general
|
100
|
+
|
96
101
|
# Attributes
|
97
102
|
#####################################
|
98
103
|
|
@@ -452,6 +457,7 @@ module JSS
|
|
452
457
|
obj << @scope.scope_xml
|
453
458
|
add_category_to_xml doc
|
454
459
|
add_self_service_xml doc
|
460
|
+
add_site_to_xml doc
|
455
461
|
add_vpp_xml doc
|
456
462
|
doc.to_s
|
457
463
|
end
|
@@ -6,6 +6,13 @@ 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
|
+
|
9
16
|
### The base for REST resources of this class
|
10
17
|
RSRC_BASE = 'mobiledeviceconfigurationprofiles'.freeze
|
11
18
|
|
@@ -21,6 +28,35 @@ module JSS
|
|
21
28
|
# See {APIObject#add_object_history_entry}
|
22
29
|
OBJECT_HISTORY_OBJECT_TYPE = 22
|
23
30
|
|
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
|
+
|
24
60
|
end
|
25
61
|
|
26
62
|
end
|