ruby-jss 0.7.0 → 0.8.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 +29 -22
- data/README.md +66 -86
- data/bin/jamfHelperBackgrounder +148 -0
- data/bin/netseg-update +0 -1
- data/lib/jss.rb +20 -9
- data/lib/jss/api_connection.rb +369 -295
- data/lib/jss/api_object.rb +651 -418
- data/lib/jss/api_object/account.rb +69 -77
- data/lib/jss/api_object/advanced_search.rb +201 -236
- data/lib/jss/api_object/advanced_search/advanced_computer_search.rb +42 -42
- data/lib/jss/api_object/advanced_search/advanced_mobile_device_search.rb +33 -43
- data/lib/jss/api_object/advanced_search/advanced_user_search.rb +33 -43
- data/lib/jss/api_object/building.rb +39 -52
- data/lib/jss/api_object/categorizable.rb +221 -0
- data/lib/jss/api_object/category.rb +81 -89
- data/lib/jss/api_object/computer.rb +486 -525
- data/lib/jss/api_object/computer_invitation.rb +73 -86
- data/lib/jss/api_object/criteriable.rb +6 -7
- data/lib/jss/api_object/ebook.rb +21 -0
- data/lib/jss/api_object/extendable.rb +6 -8
- data/lib/jss/api_object/group.rb +0 -3
- data/lib/jss/api_object/locatable.rb +19 -20
- data/lib/jss/api_object/mac_application.rb +21 -0
- data/lib/jss/api_object/mobile_device.rb +30 -21
- data/lib/jss/api_object/mobile_device_application.rb +447 -0
- data/lib/jss/api_object/mobile_device_configuration_profile.rb +21 -0
- data/lib/jss/api_object/osx_configuration_profile.rb +0 -3
- data/lib/jss/api_object/package.rb +21 -34
- data/lib/jss/api_object/peripheral.rb +16 -18
- data/lib/jss/api_object/policy.rb +5 -83
- data/lib/jss/api_object/purchasable.rb +11 -13
- data/lib/jss/api_object/scopable.rb +11 -12
- data/lib/jss/api_object/script.rb +3 -17
- data/lib/jss/api_object/self_servable.rb +419 -205
- data/lib/jss/api_object/self_servable/icon.rb +179 -0
- data/lib/jss/api_object/updatable.rb +35 -34
- data/lib/jss/api_object/uploadable.rb +72 -70
- data/lib/jss/api_object/user.rb +6 -7
- data/lib/jss/api_object/vppable.rb +117 -0
- data/lib/jss/client.rb +264 -225
- data/lib/jss/db_connection.rb +7 -5
- data/lib/jss/exceptions.rb +50 -42
- data/lib/jss/ruby_extensions.rb +8 -7
- data/lib/jss/ruby_extensions/object.rb +19 -0
- data/lib/jss/utility.rb +82 -40
- data/lib/jss/version.rb +1 -1
- metadata +37 -68
- data/bin/jss-webhook-server +0 -3
- data/lib/jss/webhooks.rb +0 -53
- data/lib/jss/webhooks/README.md +0 -269
- data/lib/jss/webhooks/configuration.rb +0 -213
- data/lib/jss/webhooks/data/sample_handlers/RestAPIOperation-executable +0 -91
- data/lib/jss/webhooks/data/sample_handlers/RestAPIOperation.rb +0 -45
- data/lib/jss/webhooks/data/sample_jsons/ComputerAdded.json +0 -27
- data/lib/jss/webhooks/data/sample_jsons/ComputerCheckIn.json +0 -27
- data/lib/jss/webhooks/data/sample_jsons/ComputerInventoryCompleted.json +0 -27
- data/lib/jss/webhooks/data/sample_jsons/ComputerPolicyFinished.json +0 -27
- data/lib/jss/webhooks/data/sample_jsons/ComputerPushCapabilityChanged.json +0 -27
- data/lib/jss/webhooks/data/sample_jsons/JSSShutdown.json +0 -14
- data/lib/jss/webhooks/data/sample_jsons/JSSStartup.json +0 -14
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceCheckIn.json +0 -26
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceCommandCompleted.json +0 -26
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceEnrolled.json +0 -26
- data/lib/jss/webhooks/data/sample_jsons/MobileDevicePushSent.json +0 -26
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceUnEnrolled.json +0 -26
- data/lib/jss/webhooks/data/sample_jsons/PatchSoftwareTitleUpdated.json +0 -14
- data/lib/jss/webhooks/data/sample_jsons/PushSent.json +0 -11
- data/lib/jss/webhooks/data/sample_jsons/RestAPIOperation.json +0 -15
- data/lib/jss/webhooks/data/sample_jsons/SCEPChallenge.json +0 -10
- data/lib/jss/webhooks/data/sample_jsons/SmartGroupComputerMembershipChange.json +0 -13
- data/lib/jss/webhooks/data/sample_jsons/SmartGroupMobileDeviceMembershipChange.json +0 -13
- data/lib/jss/webhooks/event.rb +0 -139
- data/lib/jss/webhooks/event/computer_added.rb +0 -38
- data/lib/jss/webhooks/event/computer_check_in.rb +0 -38
- data/lib/jss/webhooks/event/computer_inventory_completed.rb +0 -38
- data/lib/jss/webhooks/event/computer_policy_finished.rb +0 -38
- data/lib/jss/webhooks/event/computer_push_capability_changed.rb +0 -38
- data/lib/jss/webhooks/event/handlers.rb +0 -192
- data/lib/jss/webhooks/event/jss_shutdown.rb +0 -38
- data/lib/jss/webhooks/event/jss_startup.rb +0 -38
- data/lib/jss/webhooks/event/mobile_device_check_in.rb +0 -38
- data/lib/jss/webhooks/event/mobile_device_command_completed.rb +0 -38
- data/lib/jss/webhooks/event/mobile_device_enrolled.rb +0 -38
- data/lib/jss/webhooks/event/mobile_device_push_sent.rb +0 -38
- data/lib/jss/webhooks/event/mobile_device_unenrolled.rb +0 -38
- data/lib/jss/webhooks/event/patch_software_title_updated.rb +0 -38
- data/lib/jss/webhooks/event/push_sent.rb +0 -38
- data/lib/jss/webhooks/event/rest_api_operation.rb +0 -38
- data/lib/jss/webhooks/event/scep_challenge.rb +0 -38
- data/lib/jss/webhooks/event/smart_group_computer_membership_change.rb +0 -38
- data/lib/jss/webhooks/event/smart_group_mobile_device_membership_change.rb +0 -38
- data/lib/jss/webhooks/event/webhook.rb +0 -40
- data/lib/jss/webhooks/event_objects.rb +0 -112
- data/lib/jss/webhooks/event_objects/computer.rb +0 -49
- data/lib/jss/webhooks/event_objects/jss.rb +0 -36
- data/lib/jss/webhooks/event_objects/mobile_device.rb +0 -48
- data/lib/jss/webhooks/event_objects/patch_software_title_update.rb +0 -38
- data/lib/jss/webhooks/event_objects/push.rb +0 -33
- data/lib/jss/webhooks/event_objects/rest_api_operation.rb +0 -37
- data/lib/jss/webhooks/event_objects/scep_challenge.rb +0 -32
- data/lib/jss/webhooks/event_objects/smart_group.rb +0 -35
- data/lib/jss/webhooks/server_app.rb +0 -37
- data/lib/jss/webhooks/server_app/routes.rb +0 -27
- data/lib/jss/webhooks/server_app/routes/handle_webhook_event.rb +0 -39
- data/lib/jss/webhooks/server_app/routes/home.rb +0 -37
- data/lib/jss/webhooks/server_app/self_signed_cert.rb +0 -65
- data/lib/jss/webhooks/server_app/server.rb +0 -60
- data/lib/jss/webhooks/version.rb +0 -32
@@ -0,0 +1,21 @@
|
|
1
|
+
# This is just a stub for now.
|
2
|
+
|
3
|
+
#
|
4
|
+
module JSS
|
5
|
+
|
6
|
+
#
|
7
|
+
class MobileDeviceConfigurationProfile < APIObject
|
8
|
+
|
9
|
+
### The base for REST resources of this class
|
10
|
+
RSRC_BASE = 'mobiledeviceconfigurationprofiles'.freeze
|
11
|
+
|
12
|
+
### the hash key used for the JSON list output of all objects in the JSS
|
13
|
+
RSRC_LIST_KEY = :configuration_profiles
|
14
|
+
|
15
|
+
### The hash key used for the JSON object output.
|
16
|
+
### It's also used in various error messages
|
17
|
+
RSRC_OBJECT_KEY = :configuration_profile
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -48,6 +48,7 @@ module JSS
|
|
48
48
|
### Mix-Ins
|
49
49
|
#####################################
|
50
50
|
|
51
|
+
include JSS::Categorizable
|
51
52
|
include JSS::Creatable
|
52
53
|
include JSS::Updatable
|
53
54
|
|
@@ -127,9 +128,6 @@ module JSS
|
|
127
128
|
### @return [Boolean] can this item be uninstalled? Some, e.g. OS Updates, can't
|
128
129
|
attr_reader :allow_uninstalled
|
129
130
|
|
130
|
-
### @return [String] the category of this pkg, stored in the JSS as the id number from the categories table
|
131
|
-
attr_reader :category
|
132
|
-
|
133
131
|
### @return [String] the info field for this pkg - stores d3's basename & swupdate values
|
134
132
|
attr_reader :info
|
135
133
|
|
@@ -156,8 +154,6 @@ module JSS
|
|
156
154
|
### now we have pkg_data with something in it, so fill out the instance vars
|
157
155
|
@allow_uninstalled = @init_data[:allow_uninstalled]
|
158
156
|
@boot_volume_required = @init_data[:boot_volume_required]
|
159
|
-
@category = JSS::APIObject.get_name(@init_data[:category])
|
160
|
-
@category = nil if @category.to_s.casecmp('No category assigned').zero?
|
161
157
|
@filename = @init_data[:filename] || @init_data[:name]
|
162
158
|
@fill_existing_users = @init_data[:fill_existing_users]
|
163
159
|
@fill_user_template = @init_data[:fill_user_template]
|
@@ -214,21 +210,6 @@ module JSS
|
|
214
210
|
@need_to_update = true
|
215
211
|
end
|
216
212
|
|
217
|
-
### Change the category in the JSS
|
218
|
-
###
|
219
|
-
### @param new_val[String] must be one listed by 'JSS::Category.all_names'
|
220
|
-
###
|
221
|
-
### @return [void]
|
222
|
-
###
|
223
|
-
def category=(new_val)
|
224
|
-
return nil if new_val == @category
|
225
|
-
new_val = nil if new_val == ''
|
226
|
-
new_val ||= JSS::Category::DEFAULT_CATEGORY
|
227
|
-
raise JSS::InvalidDataError, "Category #{new_val} is not known to the JSS" unless JSS::Category.all_names.include? new_val
|
228
|
-
@category = new_val
|
229
|
-
@need_to_update = true
|
230
|
-
end
|
231
|
-
|
232
213
|
### Change the package filename.
|
233
214
|
### Setting it to nil or empty will make it match the display name
|
234
215
|
###
|
@@ -459,7 +440,10 @@ module JSS
|
|
459
440
|
|
460
441
|
### Upload a locally-readable file to the master distribution point.
|
461
442
|
### If the file is a directory (like a bundle .pk/.mpkg) it will be zipped before
|
462
|
-
### uploading and the @filename will be adjusted accordingly
|
443
|
+
### uploading and the @filename will be adjusted accordingly by adding a .zip extension
|
444
|
+
###
|
445
|
+
### The name of the local file doesn't matter, the file on the dist. point will
|
446
|
+
### use the @filename (possibly with .zip)
|
463
447
|
###
|
464
448
|
### If you'll be uploading several files you can specify unmount as false, and do it manually when all
|
465
449
|
### are finished with JSS::DistributionPoint.master_distribution_point.unmount
|
@@ -485,34 +469,37 @@ module JSS
|
|
485
469
|
### should we zip it?
|
486
470
|
if local_path.directory?
|
487
471
|
begin
|
488
|
-
zipdir = Pathname.new "/tmp/jssgemtmp-#{Time.new.strftime '%Y%m%d%H%M%S'}-#{$PROCESS_ID}"
|
489
|
-
zipdir.mkpath
|
490
|
-
zipdir.chmod 0o700
|
491
|
-
zipfile = zipdir + (local_path.basename.to_s + '.zip')
|
492
|
-
|
493
472
|
### go to the same dir as the local file
|
494
473
|
wd = Dir.pwd
|
495
474
|
Dir.chdir local_path.parent
|
496
475
|
|
497
476
|
### the contents of the zip file have to have the same name as the zip file itself (minus the .zip)
|
498
477
|
### so temporarily rename the source
|
499
|
-
local_path.
|
500
|
-
|
478
|
+
local_path_to_upload = local_path.parent + @filename
|
479
|
+
local_path.rename local_path_to_upload unless local_path_to_upload == local_path
|
480
|
+
|
481
|
+
zipdir = Pathname.new "/tmp/rubyjsstmp-#{Time.new.strftime '%Y%m%d%H%M%S'}-#{$PROCESS_ID}"
|
482
|
+
zipdir.mkpath
|
483
|
+
zipdir.chmod 0o700
|
484
|
+
zipfile = zipdir + (local_path_to_upload.basename.to_s + '.zip')
|
485
|
+
|
486
|
+
raise 'There was a problem zipping the pkg bundle' unless system "/usr/bin/zip -qr '#{zipfile}' '#{local_path_to_upload}'"
|
501
487
|
|
502
488
|
ensure
|
503
489
|
### rename the source to the original name
|
504
|
-
|
490
|
+
local_path_to_upload.rename local_path if local_path_to_upload.exist? && local_path_to_upload != local_path
|
505
491
|
### go back where we started
|
506
492
|
Dir.chdir wd
|
507
493
|
end # begin
|
508
494
|
|
509
495
|
### update our info
|
510
496
|
local_path = zipfile
|
511
|
-
|
512
|
-
|
513
|
-
|
497
|
+
destination = destination.to_s + '.zip'
|
498
|
+
@filename = zipfile.basename.to_s
|
499
|
+
@need_to_update = true
|
500
|
+
update
|
514
501
|
end # if directory
|
515
|
-
|
502
|
+
|
516
503
|
FileUtils.copy_entry local_path, destination
|
517
504
|
|
518
505
|
mdp.unmount if unmount
|
@@ -796,7 +783,6 @@ module JSS
|
|
796
783
|
pkg = doc.add_element 'package'
|
797
784
|
pkg.add_element('allow_uninstalled').text = @allow_uninstalled
|
798
785
|
pkg.add_element('boot_volume_required').text = @boot_volume_required
|
799
|
-
pkg.add_element('category').text = @category.to_s.casecmp('No category assigned').zero? ? '' : @category
|
800
786
|
pkg.add_element('filename').text = @filename
|
801
787
|
pkg.add_element('fill_existing_users').text = @fill_existing_users
|
802
788
|
pkg.add_element('fill_user_template').text = @fill_user_template
|
@@ -810,6 +796,7 @@ module JSS
|
|
810
796
|
pkg.add_element('required_processor').text = @required_processor.to_s.empty? ? 'None' : @required_processor
|
811
797
|
pkg.add_element('send_notification').text = @send_notification
|
812
798
|
pkg.add_element('switch_with_package').text = @switch_with_package
|
799
|
+
add_category_to_xml(doc)
|
813
800
|
doc.to_s
|
814
801
|
end # rest xml
|
815
802
|
|
@@ -1,26 +1,26 @@
|
|
1
1
|
### Copyright 2017 Pixar
|
2
2
|
|
3
|
-
###
|
3
|
+
###
|
4
4
|
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
5
|
### with the following modification; you may not use this file except in
|
6
6
|
### compliance with the Apache License and the following modification to it:
|
7
7
|
### Section 6. Trademarks. is deleted and replaced with:
|
8
|
-
###
|
8
|
+
###
|
9
9
|
### 6. Trademarks. This License does not grant permission to use the trade
|
10
10
|
### names, trademarks, service marks, or product names of the Licensor
|
11
11
|
### and its affiliates, except as required to comply with Section 4(c) of
|
12
12
|
### the License and to reproduce the content of the NOTICE file.
|
13
|
-
###
|
13
|
+
###
|
14
14
|
### You may obtain a copy of the Apache License at
|
15
|
-
###
|
15
|
+
###
|
16
16
|
### http://www.apache.org/licenses/LICENSE-2.0
|
17
|
-
###
|
17
|
+
###
|
18
18
|
### Unless required by applicable law or agreed to in writing, software
|
19
19
|
### distributed under the Apache License with the above modification is
|
20
20
|
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
21
|
### KIND, either express or implied. See the Apache License for the specific
|
22
22
|
### language governing permissions and limitations under the Apache License.
|
23
|
-
###
|
23
|
+
###
|
24
24
|
###
|
25
25
|
|
26
26
|
###
|
@@ -101,11 +101,11 @@ module JSS
|
|
101
101
|
|
102
102
|
### @return [String] the "bar code 1" value
|
103
103
|
attr_reader :bar_code_1
|
104
|
-
|
104
|
+
|
105
105
|
|
106
106
|
### @return [String] the "bar code 2" value
|
107
107
|
attr_reader :bar_code_2
|
108
|
-
|
108
|
+
|
109
109
|
|
110
110
|
### @return [Integer] the id number of the computer to which this periph is connected
|
111
111
|
attr_reader :computer_id
|
@@ -149,8 +149,6 @@ module JSS
|
|
149
149
|
### get the field defs for this PeriphType, omitting the leading nil
|
150
150
|
@field_defs ||= JSS::PeripheralType.new(:name => @type).fields.compact
|
151
151
|
|
152
|
-
parse_location
|
153
|
-
parse_purchasing
|
154
152
|
|
155
153
|
end # initialize
|
156
154
|
|
@@ -209,7 +207,7 @@ module JSS
|
|
209
207
|
@bar_code_1 = new_value
|
210
208
|
@need_to_update = true
|
211
209
|
end
|
212
|
-
|
210
|
+
|
213
211
|
|
214
212
|
###
|
215
213
|
### Set the value of barcode 2
|
@@ -222,7 +220,7 @@ module JSS
|
|
222
220
|
@bar_code_2 = new_value
|
223
221
|
@need_to_update = true
|
224
222
|
end
|
225
|
-
|
223
|
+
|
226
224
|
|
227
225
|
###
|
228
226
|
### Associate this peripheral with a computer.
|
@@ -241,7 +239,7 @@ module JSS
|
|
241
239
|
end
|
242
240
|
@need_to_update = true
|
243
241
|
end
|
244
|
-
|
242
|
+
|
245
243
|
|
246
244
|
###
|
247
245
|
### Disassociate this peripheral from any computer.
|
@@ -255,7 +253,7 @@ module JSS
|
|
255
253
|
@computer_id = nil
|
256
254
|
@need_to_update = true
|
257
255
|
end
|
258
|
-
|
256
|
+
|
259
257
|
|
260
258
|
#################################
|
261
259
|
### Private Methods below here
|
@@ -317,20 +315,20 @@ module JSS
|
|
317
315
|
|
318
316
|
return doc.to_s
|
319
317
|
end # rest xml
|
320
|
-
|
318
|
+
|
321
319
|
### Aliases
|
322
320
|
alias barcode_1 bar_code_1
|
323
321
|
alias barcode1 bar_code_1
|
324
322
|
alias barcode_1= bar_code_1=
|
325
323
|
alias barcode1= bar_code_1=
|
326
|
-
|
324
|
+
|
327
325
|
alias barcode_2 bar_code_2
|
328
326
|
alias barcode2 bar_code_2
|
329
327
|
alias barcode_2= bar_code_2=
|
330
328
|
alias barcode2= bar_code_2=
|
331
|
-
|
329
|
+
|
332
330
|
alias assign_to associate
|
333
331
|
alias unassign disassociate
|
334
|
-
|
332
|
+
|
335
333
|
end # class Peripheral
|
336
334
|
end # module
|
@@ -76,6 +76,8 @@ module JSS
|
|
76
76
|
include JSS::Scopable
|
77
77
|
include JSS::Uploadable
|
78
78
|
include JSS::SelfServable
|
79
|
+
include JSS::Categorizable
|
80
|
+
|
79
81
|
|
80
82
|
#####################################
|
81
83
|
### Class Methods
|
@@ -217,9 +219,6 @@ module JSS
|
|
217
219
|
### the JSS WebApp. They are general settings for this policy.
|
218
220
|
### We'll map it to direct attributes.
|
219
221
|
|
220
|
-
### @return [String] policy category name
|
221
|
-
attr_reader :category
|
222
|
-
|
223
222
|
### @return [String] how often to run the policy on each computer
|
224
223
|
attr_reader :frequency
|
225
224
|
|
@@ -533,7 +532,6 @@ module JSS
|
|
533
532
|
|
534
533
|
if @in_jss
|
535
534
|
gen = @init_data[:general]
|
536
|
-
@category = JSS::APIObject.get_name(gen[:category])
|
537
535
|
@frequency = gen[:frequency]
|
538
536
|
@target_drive = gen[:target_drive]
|
539
537
|
@offline = gen[:offline]
|
@@ -601,9 +599,6 @@ module JSS
|
|
601
599
|
|
602
600
|
@printers = @init_data[:printers]
|
603
601
|
|
604
|
-
parse_scope
|
605
|
-
parse_self_service
|
606
|
-
@in_self_service = @init_data[:self_service][:use_for_self_service]
|
607
602
|
|
608
603
|
### Not in jss yet
|
609
604
|
end
|
@@ -699,21 +694,6 @@ module JSS
|
|
699
694
|
@need_to_update = true
|
700
695
|
end
|
701
696
|
|
702
|
-
### Change the category of this policy, arg is a category name
|
703
|
-
###
|
704
|
-
### @param new_val[String] the name of the new category
|
705
|
-
###
|
706
|
-
### @return [void]
|
707
|
-
###
|
708
|
-
def category=(new_val = JSS::Category::DEFAULT_CATEGORY)
|
709
|
-
return nil if @category == new_val
|
710
|
-
new_val = nil if new_val == ''
|
711
|
-
new_val ||= JSS::Category::DEFAULT_CATEGORY
|
712
|
-
raise JSS::NoSuchItemError, "No category '#{new_val}' in the JSS" unless JSS::Category.all_names(:refresh).include? new_val
|
713
|
-
@category = new_val
|
714
|
-
@need_to_update = true
|
715
|
-
end
|
716
|
-
|
717
697
|
### Change a trigger event
|
718
698
|
###
|
719
699
|
### @param type[Symbol] the type of trigger, one of the keys of {TRIGGER_EVENTS}
|
@@ -1106,62 +1086,6 @@ module JSS
|
|
1106
1086
|
@printers.map { |p| p[:name] }
|
1107
1087
|
end
|
1108
1088
|
|
1109
|
-
###### SelfService
|
1110
|
-
### Is this policy in self service?
|
1111
|
-
###
|
1112
|
-
### @return [Boolean] Is this policy in self service?
|
1113
|
-
###
|
1114
|
-
def in_self_service?
|
1115
|
-
@in_self_service
|
1116
|
-
end
|
1117
|
-
|
1118
|
-
### policies in self service aren't 'removable'
|
1119
|
-
###
|
1120
|
-
### @return [FalseClass]
|
1121
|
-
###
|
1122
|
-
def user_removable?
|
1123
|
-
false
|
1124
|
-
end
|
1125
|
-
alias user_removable= user_removable?
|
1126
|
-
|
1127
|
-
### Add this policy to Self Service
|
1128
|
-
###
|
1129
|
-
### @return [void]
|
1130
|
-
def add_to_self_service
|
1131
|
-
@need_to_update = (@in_self_service == false)
|
1132
|
-
@in_self_service = true
|
1133
|
-
end
|
1134
|
-
|
1135
|
-
### Remove this policy from Self Service
|
1136
|
-
###
|
1137
|
-
### @return [void]
|
1138
|
-
def remove_from_self_service
|
1139
|
-
@need_to_update = (@in_self_service == true)
|
1140
|
-
@in_self_service = false
|
1141
|
-
end
|
1142
|
-
|
1143
|
-
### Select or upload an image file to be the self service icon.
|
1144
|
-
### The policy must already exist in the JSS to upload an image.
|
1145
|
-
###
|
1146
|
-
### NOTE: There is no way to verify the validity of an icon id, as they are not
|
1147
|
-
### available via the API. Caveat Emptor.
|
1148
|
-
###
|
1149
|
-
### NOTE: When setting by id, {#update} or #{save} must be used to save the change.
|
1150
|
-
###
|
1151
|
-
### @param icon [String, Pathname, Integer] the path to the local image file, to upload
|
1152
|
-
### or the id of a previously uploaded one.
|
1153
|
-
###
|
1154
|
-
### @return [void]
|
1155
|
-
###
|
1156
|
-
def assign_icon(icon)
|
1157
|
-
if icon.is_a? Integer
|
1158
|
-
@self_service_icon = { id: icon }
|
1159
|
-
@need_to_update = true
|
1160
|
-
return
|
1161
|
-
end
|
1162
|
-
upload(:icon, icon)
|
1163
|
-
end
|
1164
|
-
|
1165
1089
|
###### Actions
|
1166
1090
|
|
1167
1091
|
### Try to execute this policy on this machine.
|
@@ -1186,7 +1110,6 @@ module JSS
|
|
1186
1110
|
alias command_to_run run_command
|
1187
1111
|
alias delete_path? delete_file?
|
1188
1112
|
alias execute run
|
1189
|
-
alias self_service? in_self_service?
|
1190
1113
|
|
1191
1114
|
### Private Instance Methods
|
1192
1115
|
#####################################
|
@@ -1202,7 +1125,8 @@ module JSS
|
|
1202
1125
|
general.add_element('frequency').text = @frequency
|
1203
1126
|
general.add_element('target_drive').text = @target_drive
|
1204
1127
|
general.add_element('offline').text = @offline
|
1205
|
-
|
1128
|
+
|
1129
|
+
add_category_to_xml(doc)
|
1206
1130
|
|
1207
1131
|
JSS.hash_to_rexml_array(@trigger_events).each { |t| general << t }
|
1208
1132
|
|
@@ -1226,9 +1150,7 @@ module JSS
|
|
1226
1150
|
sdeets.each { |d| script << d }
|
1227
1151
|
end
|
1228
1152
|
|
1229
|
-
|
1230
|
-
self_svc.add_element('use_for_self_service').text = @in_self_service
|
1231
|
-
obj << self_svc
|
1153
|
+
add_self_service_xml doc
|
1232
1154
|
|
1233
1155
|
doc.to_s
|
1234
1156
|
end
|
@@ -1,26 +1,26 @@
|
|
1
1
|
### Copyright 2017 Pixar
|
2
2
|
|
3
|
-
###
|
3
|
+
###
|
4
4
|
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
5
|
### with the following modification; you may not use this file except in
|
6
6
|
### compliance with the Apache License and the following modification to it:
|
7
7
|
### Section 6. Trademarks. is deleted and replaced with:
|
8
|
-
###
|
8
|
+
###
|
9
9
|
### 6. Trademarks. This License does not grant permission to use the trade
|
10
10
|
### names, trademarks, service marks, or product names of the Licensor
|
11
11
|
### and its affiliates, except as required to comply with Section 4(c) of
|
12
12
|
### the License and to reproduce the content of the NOTICE file.
|
13
|
-
###
|
13
|
+
###
|
14
14
|
### You may obtain a copy of the Apache License at
|
15
|
-
###
|
15
|
+
###
|
16
16
|
### http://www.apache.org/licenses/LICENSE-2.0
|
17
|
-
###
|
17
|
+
###
|
18
18
|
### Unless required by applicable law or agreed to in writing, software
|
19
19
|
### distributed under the Apache License with the above modification is
|
20
20
|
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
21
|
### KIND, either express or implied. See the Apache License for the specific
|
22
22
|
### language governing permissions and limitations under the Apache License.
|
23
|
-
###
|
23
|
+
###
|
24
24
|
###
|
25
25
|
|
26
26
|
###
|
@@ -58,8 +58,6 @@ module JSS
|
|
58
58
|
###
|
59
59
|
### These items become direct attributes of objects where this module is mixed-in.
|
60
60
|
###
|
61
|
-
### Classes mixing in this module must call {#parse_purchasing} in their initialization method
|
62
|
-
### in order to populate the attributes from @init_data.
|
63
61
|
###
|
64
62
|
### If the class also is Creatable or Updatable it must include the value of {#purchasing_xml} in its
|
65
63
|
### rest_xml output.
|
@@ -231,12 +229,12 @@ module JSS
|
|
231
229
|
@vendor or \
|
232
230
|
@warranty_expires
|
233
231
|
end
|
234
|
-
|
232
|
+
|
235
233
|
###
|
236
234
|
### All the purchasing data in a Hash, as it comes from the API.
|
237
235
|
###
|
238
236
|
### The reason it isn't stored this way is to prevent editing of the hash directly.
|
239
|
-
###
|
237
|
+
###
|
240
238
|
### @return [Hash<String>] the location data
|
241
239
|
###
|
242
240
|
def purchasing
|
@@ -255,7 +253,7 @@ module JSS
|
|
255
253
|
:warranty_expires => @warranty_expires,
|
256
254
|
}
|
257
255
|
end
|
258
|
-
|
256
|
+
|
259
257
|
###
|
260
258
|
### @api private
|
261
259
|
###
|
@@ -308,10 +306,10 @@ module JSS
|
|
308
306
|
purch.add_element('warranty_expires_epoch').text = @warranty_expires ? @warranty_expires.to_jss_epoch : nil
|
309
307
|
return purch
|
310
308
|
end
|
311
|
-
|
309
|
+
|
312
310
|
### Aliases
|
313
311
|
alias leased? is_leased
|
314
312
|
alias purchased? is_purchased
|
315
|
-
|
313
|
+
|
316
314
|
end # module Purchasable
|
317
315
|
end # module JSS
|