ruby-jss 1.2.6 → 1.4.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 +189 -1
- data/README.md +1 -1
- data/bin/cgrouper +1 -1
- data/bin/jamfHelperBackgrounder +1 -1
- data/bin/netseg-update +1 -1
- data/data/ruby-jss.conf.example +1 -1
- data/lib/jamf.rb +1 -1
- data/lib/jamf/api/abstract_classes/advanced_search.rb +1 -1
- data/lib/jamf/api/abstract_classes/collection_resource.rb +17 -9
- data/lib/jamf/api/abstract_classes/generic_reference.rb +1 -1
- data/lib/jamf/api/abstract_classes/json_object.rb +2 -2
- data/lib/jamf/api/abstract_classes/prestage.rb +2 -2
- data/lib/jamf/api/abstract_classes/prestage_skip_setup_items.rb +1 -1
- data/lib/jamf/api/abstract_classes/resource.rb +1 -1
- data/lib/jamf/api/abstract_classes/singleton_resource.rb +1 -1
- data/lib/jamf/api/attribute_classes/ip_address.rb +1 -1
- data/lib/jamf/api/attribute_classes/timestamp.rb +1 -1
- data/lib/jamf/api/connection.rb +9 -5
- data/lib/jamf/api/connection/api_error.rb +1 -1
- data/lib/jamf/api/connection/api_error_styleguide.rb +1 -1
- data/lib/jamf/api/connection/token.rb +22 -2
- data/lib/jamf/api/json_objects/account_prefs.rb +1 -1
- data/lib/jamf/api/json_objects/android_details.rb +1 -1
- data/lib/jamf/api/json_objects/appletv_details.rb +1 -1
- data/lib/jamf/api/json_objects/attachment.rb +1 -1
- data/lib/jamf/api/json_objects/cellular_network.rb +1 -1
- data/lib/jamf/api/json_objects/change_log_entry.rb +1 -1
- data/lib/jamf/api/json_objects/computer_prestage_skip_setup_items.rb +1 -1
- data/lib/jamf/api/json_objects/country.rb +1 -1
- data/lib/jamf/api/json_objects/criterion.rb +1 -1
- data/lib/jamf/api/json_objects/device_enrollment_device.rb +1 -1
- data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +1 -1
- data/lib/jamf/api/json_objects/extension_attribute_value.rb +1 -1
- data/lib/jamf/api/json_objects/installed_application.rb +1 -1
- data/lib/jamf/api/json_objects/installed_certificate.rb +1 -1
- data/lib/jamf/api/json_objects/installed_configuration_profile.rb +1 -1
- data/lib/jamf/api/json_objects/installed_ebook.rb +1 -1
- data/lib/jamf/api/json_objects/installed_provisioning_profile.rb +1 -1
- data/lib/jamf/api/json_objects/inventory_preload_extension_attribute.rb +1 -1
- data/lib/jamf/api/json_objects/ios_details.rb +1 -1
- data/lib/jamf/api/json_objects/location.rb +1 -1
- data/lib/jamf/api/json_objects/md_prestage_name.rb +1 -1
- data/lib/jamf/api/json_objects/md_prestage_names.rb +1 -1
- data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +1 -1
- data/lib/jamf/api/json_objects/mobile_device_details.rb +1 -1
- data/lib/jamf/api/json_objects/mobile_device_security.rb +1 -1
- data/lib/jamf/api/json_objects/prestage_assignment.rb +1 -1
- data/lib/jamf/api/json_objects/prestage_location.rb +1 -1
- data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +1 -1
- data/lib/jamf/api/json_objects/prestage_scope.rb +1 -1
- data/lib/jamf/api/json_objects/prestage_sync_status.rb +1 -1
- data/lib/jamf/api/json_objects/purchasing_data.rb +1 -1
- data/lib/jamf/api/mixins/abstract.rb +1 -1
- data/lib/jamf/api/mixins/bulk_deletable.rb +1 -1
- data/lib/jamf/api/mixins/change_log.rb +1 -1
- data/lib/jamf/api/mixins/extendable.rb +1 -1
- data/lib/jamf/api/mixins/immutable.rb +1 -1
- data/lib/jamf/api/mixins/locatable.rb +1 -1
- data/lib/jamf/api/mixins/lockable.rb +1 -1
- data/lib/jamf/api/mixins/referable.rb +1 -1
- data/lib/jamf/api/mixins/searchable.rb +1 -1
- data/lib/jamf/api/mixins/uncreatable.rb +1 -1
- data/lib/jamf/api/mixins/undeletable.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/account.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/advanced_mobile_device_search.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/advanced_user_search.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/building.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/category.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/computer.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/department.rb +2 -2
- data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +4 -4
- data/lib/jamf/api/resources/collection_resources/extension_attribute.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/mobile_device.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/script.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/site.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/time_zone.rb +1 -1
- data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +1 -1
- data/lib/jamf/api/resources/singleton_resources/authorization.rb +1 -1
- data/lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb +1 -1
- data/lib/jamf/api/resources/singleton_resources/reenrollment_settings.rb +1 -1
- data/lib/jamf/client.rb +1 -1
- data/lib/jamf/client/jamf_binary.rb +1 -1
- data/lib/jamf/client/jamf_helper.rb +1 -1
- data/lib/jamf/client/management_action.rb +1 -1
- data/lib/jamf/compatibility.rb +1 -1
- data/lib/jamf/composer.rb +1 -1
- data/lib/jamf/configuration.rb +8 -10
- data/lib/jamf/exceptions.rb +1 -1
- data/lib/jamf/ruby_extensions.rb +2 -1
- data/lib/jamf/ruby_extensions/array.rb +2 -2
- data/lib/jamf/ruby_extensions/array/predicates.rb +1 -1
- data/lib/jamf/ruby_extensions/array/utils.rb +4 -4
- data/lib/jamf/ruby_extensions/dig.rb +52 -0
- data/lib/jamf/ruby_extensions/filetest.rb +1 -1
- data/lib/jamf/ruby_extensions/filetest/predicates.rb +1 -1
- data/lib/jamf/ruby_extensions/hash.rb +1 -1
- data/lib/jamf/ruby_extensions/hash/backports.rb +2 -2
- data/lib/jamf/ruby_extensions/ipaddr.rb +1 -1
- data/lib/jamf/ruby_extensions/ipaddr/utils.rb +1 -1
- data/lib/jamf/ruby_extensions/object.rb +1 -1
- data/lib/jamf/ruby_extensions/object/predicates.rb +1 -1
- data/lib/jamf/ruby_extensions/pathname.rb +1 -1
- data/lib/jamf/ruby_extensions/pathname/predicates.rb +1 -1
- data/lib/jamf/ruby_extensions/pathname/utils.rb +1 -1
- data/lib/jamf/ruby_extensions/string.rb +1 -1
- data/lib/jamf/ruby_extensions/string/backports.rb +1 -1
- data/lib/jamf/ruby_extensions/string/conversions.rb +1 -1
- data/lib/jamf/ruby_extensions/string/predicates.rb +14 -4
- data/lib/jamf/utility.rb +1 -1
- data/lib/jamf/validate.rb +1 -1
- data/lib/jamf/version.rb +2 -2
- data/lib/jpapi.rb +1 -1
- data/lib/jss-api.rb +1 -1
- data/lib/jss.rb +3 -1
- data/lib/jss/api_connection.rb +3 -30
- data/lib/jss/api_object.rb +23 -4
- data/lib/jss/api_object/account.rb +1 -1
- data/lib/jss/api_object/advanced_search.rb +28 -27
- data/lib/jss/api_object/advanced_search/advanced_computer_search.rb +1 -1
- data/lib/jss/api_object/advanced_search/advanced_mobile_device_search.rb +1 -1
- data/lib/jss/api_object/advanced_search/advanced_user_search.rb +1 -1
- data/lib/jss/api_object/app_store_country_codes.rb +298 -0
- data/lib/jss/api_object/building.rb +1 -1
- data/lib/jss/api_object/categorizable.rb +1 -1
- data/lib/jss/api_object/category.rb +1 -1
- data/lib/jss/api_object/computer.rb +12 -6
- data/lib/jss/api_object/computer/application_installs.rb +1 -1
- data/lib/jss/api_object/computer_invitation.rb +1 -1
- data/lib/jss/api_object/configuration_profile.rb +4 -2
- data/lib/jss/api_object/configuration_profile/mobile_device_configuration_profile.rb +1 -1
- data/lib/jss/api_object/configuration_profile/osx_configuration_profile.rb +1 -1
- data/lib/jss/api_object/creatable.rb +1 -1
- data/lib/jss/api_object/criteriable.rb +1 -1
- data/lib/jss/api_object/criteriable/criteria.rb +1 -1
- data/lib/jss/api_object/criteriable/criterion.rb +1 -1
- data/lib/jss/api_object/department.rb +1 -1
- data/lib/jss/api_object/directory_binding.rb +273 -0
- data/lib/jss/api_object/directory_binding_type.rb +90 -0
- data/lib/jss/api_object/directory_binding_type/active_directory.rb +502 -0
- data/lib/jss/api_object/directory_binding_type/admitmac.rb +525 -0
- data/lib/jss/api_object/directory_binding_type/centrify.rb +212 -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 +96 -36
- data/lib/jss/api_object/dock_item.rb +137 -0
- data/lib/jss/api_object/ebook.rb +2 -3
- data/lib/jss/api_object/extendable.rb +67 -28
- data/lib/jss/api_object/extension_attribute.rb +5 -4
- data/lib/jss/api_object/extension_attribute/computer_extension_attribute.rb +1 -1
- data/lib/jss/api_object/extension_attribute/mobile_device_extension_attribute.rb +1 -1
- data/lib/jss/api_object/extension_attribute/user_extension_attribute.rb +1 -1
- data/lib/jss/api_object/group.rb +1 -1
- data/lib/jss/api_object/group/computer_group.rb +1 -1
- data/lib/jss/api_object/group/mobile_device_group.rb +1 -1
- data/lib/jss/api_object/group/user_group.rb +1 -1
- data/lib/jss/api_object/ibeacon.rb +1 -1
- data/lib/jss/api_object/ldap_server.rb +1 -1
- data/lib/jss/api_object/locatable.rb +1 -1
- data/lib/jss/api_object/mac_application.rb +108 -9
- data/lib/jss/api_object/management_history.rb +1 -1
- data/lib/jss/api_object/management_history/audit_event.rb +1 -1
- data/lib/jss/api_object/management_history/casper_imaging_log.rb +1 -1
- data/lib/jss/api_object/management_history/casper_remote_log.rb +1 -1
- data/lib/jss/api_object/management_history/computer_usage_log.rb +1 -1
- data/lib/jss/api_object/management_history/ebook.rb +1 -1
- data/lib/jss/api_object/management_history/hashlike.rb +1 -1
- data/lib/jss/api_object/management_history/mac_app_store_app.rb +1 -1
- data/lib/jss/api_object/management_history/mdm_command.rb +1 -1
- data/lib/jss/api_object/management_history/mobile_device_app.rb +1 -1
- data/lib/jss/api_object/management_history/policy_log.rb +1 -1
- data/lib/jss/api_object/management_history/screen_sharing_log.rb +1 -1
- data/lib/jss/api_object/management_history/user_location_change.rb +1 -1
- data/lib/jss/api_object/matchable.rb +1 -1
- data/lib/jss/api_object/mdm.rb +1 -1
- data/lib/jss/api_object/mobile_device.rb +12 -6
- data/lib/jss/api_object/mobile_device_application.rb +13 -1
- data/lib/jss/api_object/netboot_server.rb +1 -1
- data/lib/jss/api_object/network_segment.rb +153 -59
- data/lib/jss/api_object/package.rb +106 -41
- data/lib/jss/api_object/patch_policy.rb +1 -1
- data/lib/jss/api_object/patch_source.rb +1 -1
- data/lib/jss/api_object/patch_source/patch_external_source.rb +1 -1
- data/lib/jss/api_object/patch_source/patch_internal_source.rb +1 -1
- data/lib/jss/api_object/patch_title.rb +1 -1
- data/lib/jss/api_object/patch_title/version.rb +1 -1
- data/lib/jss/api_object/peripheral.rb +1 -1
- data/lib/jss/api_object/peripheral_type.rb +1 -1
- data/lib/jss/api_object/policy.rb +492 -8
- data/lib/jss/api_object/printer.rb +440 -0
- data/lib/jss/api_object/purchasable.rb +1 -1
- data/lib/jss/api_object/removable_macaddr.rb +1 -1
- data/lib/jss/api_object/restricted_software.rb +1 -1
- data/lib/jss/api_object/scopable.rb +1 -1
- data/lib/jss/api_object/scopable/scope.rb +387 -72
- data/lib/jss/api_object/script.rb +1 -1
- data/lib/jss/api_object/self_servable.rb +24 -16
- data/lib/jss/api_object/self_servable/icon.rb +1 -1
- data/lib/jss/api_object/sitable.rb +1 -1
- data/lib/jss/api_object/site.rb +1 -1
- data/lib/jss/api_object/software_update_server.rb +1 -1
- data/lib/jss/api_object/updatable.rb +1 -1
- data/lib/jss/api_object/uploadable.rb +2 -2
- data/lib/jss/api_object/user.rb +43 -2
- data/lib/jss/api_object/vpp_account.rb +209 -0
- data/lib/jss/api_object/vppable.rb +170 -14
- data/lib/jss/api_object/webhook.rb +1 -1
- data/lib/jss/client.rb +1 -1
- data/lib/jss/client/jamf_binary.rb +1 -1
- data/lib/jss/client/jamf_helper.rb +1 -1
- data/lib/jss/client/management_action.rb +1 -1
- data/lib/jss/compatibility.rb +1 -1
- data/lib/jss/composer.rb +2 -2
- data/lib/jss/configuration.rb +1 -1
- data/lib/jss/db_connection.rb +1 -1
- data/lib/jss/exceptions.rb +1 -1
- data/lib/jss/ruby_extensions.rb +1 -1
- data/lib/jss/ruby_extensions/array.rb +1 -1
- data/lib/jss/ruby_extensions/filetest.rb +1 -1
- data/lib/jss/ruby_extensions/hash.rb +1 -1
- data/lib/jss/ruby_extensions/ipaddr.rb +1 -1
- data/lib/jss/ruby_extensions/pathname.rb +1 -1
- data/lib/jss/ruby_extensions/string.rb +1 -1
- data/lib/jss/ruby_extensions/string/backports.rb +1 -1
- data/lib/jss/ruby_extensions/string/conversions.rb +1 -1
- data/lib/jss/ruby_extensions/string/predicates.rb +14 -4
- data/lib/jss/ruby_extensions/time.rb +1 -1
- data/lib/jss/server.rb +1 -1
- data/lib/jss/utility.rb +9 -23
- data/lib/jss/validate.rb +54 -11
- data/lib/jss/version.rb +2 -2
- data/lib/jss/xml_workaround.rb +1 -1
- data/lib/ruby-jss.rb +1 -1
- data/test/bin/runtests +1 -1
- data/test/lib/testhelper.rb +1 -1
- data/test/lib/testhelper/auth.rb +1 -1
- data/test/lib/testhelper/patch_mgmt.rb +1 -1
- data/test/specs/api_connection_spec.rb +1 -1
- data/test/specs/patch01_source_spec.rb +1 -1
- data/test/specs/patch02_internal_source_spec.rb +1 -1
- data/test/specs/patch03_external_source_spec.rb +1 -1
- data/test/specs/patch04_titles_spec.rb +1 -1
- data/test/specs/patch05_policies_spec.rb +1 -1
- data/test/specs/patch06_cleanup_spec.rb +1 -1
- data/test/specs/policy_spec.rb +1 -1
- metadata +15 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
### Copyright
|
2
|
+
### Copyright 2020 Pixar
|
3
3
|
|
4
4
|
###
|
5
5
|
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
@@ -51,12 +51,12 @@ module JSS
|
|
51
51
|
# - :security
|
52
52
|
#
|
53
53
|
# Additionally, items that apper in macOS Slf Svc have these keys:
|
54
|
-
# - :self_service_display_name
|
54
|
+
# - :self_service_display_name (but not JSS::MacApplication)
|
55
55
|
# - :install_button_text
|
56
|
-
# - :reinstall_button_text
|
56
|
+
# - :reinstall_button_text (but not JSS::MacApplication)
|
57
57
|
# - :force_users_to_view_description
|
58
58
|
# - :notification
|
59
|
-
# - :notification_location # PENDING API FIX
|
59
|
+
# - :notification_location # PENDING API FIX, and also, not JSS::MacApplication
|
60
60
|
# - :notification_subject
|
61
61
|
# - :notification_message
|
62
62
|
#
|
@@ -178,15 +178,14 @@ module JSS
|
|
178
178
|
notification_reminders: true
|
179
179
|
},
|
180
180
|
JSS::MacApplication => {
|
181
|
-
|
182
|
-
# Jamf Product Issue [PI-003773]
|
183
|
-
in_self_service_data_path: [:general, :deployment_type],
|
181
|
+
in_self_service_data_path: %i[general deployment_type],
|
184
182
|
in_self_service: MAKE_AVAILABLE,
|
185
183
|
not_in_self_service: AUTO_INSTALL_OR_PROMPT,
|
186
184
|
targets: [:macos],
|
187
185
|
payload: :app,
|
188
186
|
can_display_in_categories: true,
|
189
187
|
can_feature_in_categories: true,
|
188
|
+
notifications_supported: :ssvc_and_nctr,
|
190
189
|
url_entity: 'app'
|
191
190
|
# OTHER BUG: no notification options seem to be changable via the API
|
192
191
|
},
|
@@ -329,6 +328,7 @@ module JSS
|
|
329
328
|
#
|
330
329
|
def self_service_view_url
|
331
330
|
return nil unless @self_service_data_config[:url_entity]
|
331
|
+
|
332
332
|
"#{USER_URL_BASE}#{@self_service_data_config[:url_entity]}&id=#{id}&action=#{USER_URL_VIEW_ACTION}"
|
333
333
|
end
|
334
334
|
|
@@ -336,6 +336,7 @@ module JSS
|
|
336
336
|
#
|
337
337
|
def self_service_execute_url
|
338
338
|
return nil unless @self_service_data_config[:url_entity]
|
339
|
+
|
339
340
|
"#{USER_URL_BASE}#{@self_service_data_config[:url_entity]}&id=#{id}&action=#{USER_URL_EXEC_ACTION}"
|
340
341
|
end
|
341
342
|
|
@@ -347,8 +348,9 @@ module JSS
|
|
347
348
|
# @return [void]
|
348
349
|
#
|
349
350
|
def self_service_description=(new_val)
|
350
|
-
new_val.strip
|
351
|
+
new_val = new_val.strip
|
351
352
|
return if @self_service_description == new_val
|
353
|
+
|
352
354
|
@self_service_description = new_val
|
353
355
|
@need_to_update = true
|
354
356
|
end
|
@@ -358,7 +360,7 @@ module JSS
|
|
358
360
|
# @return [void]
|
359
361
|
#
|
360
362
|
def self_service_display_name=(new_val)
|
361
|
-
new_val.strip
|
363
|
+
new_val = new_val.strip
|
362
364
|
return nil if @self_service_dislay_name == new_val
|
363
365
|
raise JSS::InvalidDataError, 'Only macOS Self Service items have display names' unless self_service_targets.include? :macos
|
364
366
|
@self_service_dislay_name = new_val
|
@@ -372,7 +374,7 @@ module JSS
|
|
372
374
|
# @return [void]
|
373
375
|
#
|
374
376
|
def self_service_install_button_text=(new_val)
|
375
|
-
new_val.strip
|
377
|
+
new_val = new_val.strip
|
376
378
|
return nil if @self_service_install_button_text == new_val
|
377
379
|
raise JSS::InvalidDataError, 'Only macOS Self Service Items can have custom button text' unless self_service_targets.include? :macos
|
378
380
|
@self_service_install_button_text = new_val
|
@@ -384,7 +386,7 @@ module JSS
|
|
384
386
|
# @return [void]
|
385
387
|
#
|
386
388
|
def self_service_reinstall_button_text=(new_val)
|
387
|
-
new_val.strip
|
389
|
+
new_val = new_val.strip
|
388
390
|
return nil if @self_service_reinstall_button_text == new_val
|
389
391
|
raise JSS::InvalidDataError, 'Only macOS Self Service Items can have custom button text' unless self_service_targets.include? :macos
|
390
392
|
@self_service_reinstall_button_text = new_val
|
@@ -532,7 +534,7 @@ module JSS
|
|
532
534
|
# @return [void]
|
533
535
|
#
|
534
536
|
def self_service_notification_subject=(subj)
|
535
|
-
subj.strip
|
537
|
+
subj = subj.strip
|
536
538
|
return if subj == @self_service_notification_subject
|
537
539
|
validate_notifications_supported
|
538
540
|
@self_service_notification_subject = subj
|
@@ -544,7 +546,7 @@ module JSS
|
|
544
546
|
# @return [void]
|
545
547
|
#
|
546
548
|
def self_service_notification_message=(msg)
|
547
|
-
msg.strip
|
549
|
+
msg = msg.strip
|
548
550
|
return if msg == @self_service_notification_message
|
549
551
|
validate_notifications_supported
|
550
552
|
@self_service_notification_message = msg
|
@@ -820,7 +822,7 @@ module JSS
|
|
820
822
|
# ssvc subset...
|
821
823
|
add_in_self_service_xml doc_root
|
822
824
|
|
823
|
-
subset_key = @self_service_data_config[:self_service_subset]
|
825
|
+
subset_key = @self_service_data_config[:self_service_subset] || :self_service
|
824
826
|
|
825
827
|
ssvc = doc_root.add_element subset_key.to_s
|
826
828
|
|
@@ -857,6 +859,7 @@ module JSS
|
|
857
859
|
# add the xml specific to profiles
|
858
860
|
def add_self_service_profile_xml(ssvc, doc_root)
|
859
861
|
return unless self_service_payload == :profile
|
862
|
+
|
860
863
|
if self_service_targets.include? :ios
|
861
864
|
sec = ssvc.add_element('security')
|
862
865
|
sec.add_element('removal_disallowed').text = PROFILE_REMOVAL_BY_USER[@self_service_user_removable]
|
@@ -871,6 +874,7 @@ module JSS
|
|
871
874
|
def add_self_service_category_xml(ssvc)
|
872
875
|
cats = ssvc.add_element('self_service_categories')
|
873
876
|
return if self_service_categories.empty?
|
877
|
+
|
874
878
|
self_service_categories.each do |cat|
|
875
879
|
catelem = cats.add_element('category')
|
876
880
|
catelem.add_element('name').text = cat[:name]
|
@@ -882,10 +886,14 @@ module JSS
|
|
882
886
|
# set macOS settings in ssvc xml
|
883
887
|
def add_self_service_macos_xml(ssvc)
|
884
888
|
return unless self_service_targets.include? :macos
|
885
|
-
|
889
|
+
|
886
890
|
ssvc.add_element('install_button_text').text = self_service_install_button_text if self_service_install_button_text
|
887
|
-
ssvc.add_element('reinstall_button_text').text = self_service_reinstall_button_text if self_service_reinstall_button_text
|
888
891
|
ssvc.add_element('force_users_to_view_description').text = self_service_force_users_to_view_description.to_s
|
892
|
+
|
893
|
+
return if self.class == JSS::MacApplication
|
894
|
+
|
895
|
+
ssvc.add_element('self_service_display_name').text = self_service_display_name if self_service_display_name
|
896
|
+
ssvc.add_element('reinstall_button_text').text = self_service_reinstall_button_text if self_service_reinstall_button_text
|
889
897
|
end
|
890
898
|
|
891
899
|
|
data/lib/jss/api_object/site.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
### Copyright
|
1
|
+
### Copyright 2020 Pixar
|
2
2
|
|
3
3
|
###
|
4
4
|
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
@@ -103,7 +103,7 @@ module JSS
|
|
103
103
|
# Methods
|
104
104
|
#####################################
|
105
105
|
|
106
|
-
|
106
|
+
|
107
107
|
# Upload a file to the JSS via the REST Resource of the
|
108
108
|
# object to which this module is mixed in.
|
109
109
|
#
|
data/lib/jss/api_object/user.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
### Copyright
|
1
|
+
### Copyright 2020 Pixar
|
2
2
|
|
3
3
|
###
|
4
4
|
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
@@ -144,7 +144,7 @@ module JSS
|
|
144
144
|
|
145
145
|
### @return [Array<Hash>]
|
146
146
|
###
|
147
|
-
### The vpp assignments associated with this user
|
147
|
+
### The user-based vpp assignments associated with this user
|
148
148
|
###
|
149
149
|
### Each Hash has then :id and :name for one assignment
|
150
150
|
###
|
@@ -249,6 +249,47 @@ module JSS
|
|
249
249
|
@need_to_update = true
|
250
250
|
end
|
251
251
|
|
252
|
+
# Workaround for the recurring Jamf Classic API Bug where
|
253
|
+
# JSON is missing data that should come in an array of hashes, but
|
254
|
+
# only comes as a hash with a single hash inside, with data for only
|
255
|
+
# the last item in the XML array.
|
256
|
+
#
|
257
|
+
# When needed, we fetch and parse the XML, which has the desired data.
|
258
|
+
# Use any truthy parameter to re-fetch the XML data, otherwise the
|
259
|
+
# data last fetched is used.
|
260
|
+
#
|
261
|
+
# In this case, the user group data is fetched as XML and returned as
|
262
|
+
# an Array of Hashes, one per group the user is a member of. Each hash
|
263
|
+
# containing three Symbol keys:
|
264
|
+
#
|
265
|
+
# id: Integer, the group id
|
266
|
+
# name: String, the group name
|
267
|
+
# is_smart: Boolean, is it a smart group or a static group?
|
268
|
+
#
|
269
|
+
# @param refresh[Boolean] Re-fetch the group data from the API
|
270
|
+
#
|
271
|
+
# @return [Array<Hash>] The groups the user is a member of.
|
272
|
+
#
|
273
|
+
def user_groups(refresh = false)
|
274
|
+
@grp_array = nil if refresh
|
275
|
+
return @grp_array if @grp_array
|
276
|
+
|
277
|
+
@grp_array = []
|
278
|
+
raw_xml = @api.get_rsrc "/users/id/#{@id}", :xml
|
279
|
+
xmlroot = REXML::Document.new(raw_xml).root
|
280
|
+
xml_grps = xmlroot.elements['user_groups']
|
281
|
+
|
282
|
+
xml_grps.each do |xml_grp|
|
283
|
+
next if xml_grp.name == 'size'
|
284
|
+
|
285
|
+
gid = xml_grp.elements['id'].text.to_i
|
286
|
+
gname = xml_grp.elements['name'].text
|
287
|
+
smart = xml_grp.elements['is_smart'].text == 'true'
|
288
|
+
@grp_array << { id: gid, name: gname, is_smart: smart }
|
289
|
+
end # groups.each
|
290
|
+
|
291
|
+
@grp_array
|
292
|
+
end # user_groups
|
252
293
|
|
253
294
|
#####################################
|
254
295
|
### Private Instance Methods
|
@@ -0,0 +1,209 @@
|
|
1
|
+
### Copyright 2020 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
|
+
# A VPP account defined in the JSS
|
30
|
+
#
|
31
|
+
class VPPAccount < JSS::APIObject
|
32
|
+
|
33
|
+
# Mix-Ins
|
34
|
+
#####################################
|
35
|
+
include JSS::Updatable
|
36
|
+
include JSS::Sitable
|
37
|
+
|
38
|
+
# Class Constants
|
39
|
+
#####################################
|
40
|
+
|
41
|
+
### The base for REST resources of this class
|
42
|
+
RSRC_BASE = 'vppaccounts'.freeze
|
43
|
+
|
44
|
+
### the hash key used for the JSON list output of all objects in the JSS
|
45
|
+
RSRC_LIST_KEY = :vpp_accounts
|
46
|
+
|
47
|
+
### The hash key used for the JSON object output.
|
48
|
+
### It's also used in various error messages
|
49
|
+
RSRC_OBJECT_KEY = :vpp_account
|
50
|
+
|
51
|
+
SITE_SUBSET = :top
|
52
|
+
|
53
|
+
# Attributes
|
54
|
+
#####################################
|
55
|
+
|
56
|
+
# @return [String] The full name of the local contact person for the acct
|
57
|
+
attr_reader :contact
|
58
|
+
|
59
|
+
# @return [String] The service token for connecting to the account at Apple.
|
60
|
+
# Currently not visible, appears as '***************'
|
61
|
+
attr_reader :service_token
|
62
|
+
|
63
|
+
# @return [String] The name of the company associated with the Acct/Token
|
64
|
+
attr_reader :account_name
|
65
|
+
|
66
|
+
# @return [Time] The expiration date of the Acct/Token
|
67
|
+
attr_reader :expiration_date
|
68
|
+
|
69
|
+
# @return [String] The location associated with the Acct/Token
|
70
|
+
attr_reader :location_name
|
71
|
+
alias location location_name
|
72
|
+
|
73
|
+
# @return [String] The Country Code associated with the acct
|
74
|
+
attr_reader :country
|
75
|
+
|
76
|
+
# @return [String] The AppleID associated with the acct
|
77
|
+
attr_reader :apple_id
|
78
|
+
|
79
|
+
# @return [Boolean] Automatically populate purchased content from Apple
|
80
|
+
# School Manager or Apple Business Manager in Jamf Pro
|
81
|
+
attr_reader :populate_catalog_from_vpp_content
|
82
|
+
|
83
|
+
# @return [Boolean] Display a notification to users on their mobile devices
|
84
|
+
# when a volume purchased app in a user-based volume assignment is no
|
85
|
+
# longer assigned to them
|
86
|
+
attr_reader :notify_disassociation
|
87
|
+
|
88
|
+
# @return [Boolean] Automatically register users that have Managed Apple IDs
|
89
|
+
# so they do not receive an invitation and are not prompted to register
|
90
|
+
# with volume purchasing
|
91
|
+
attr_reader :auto_register_managed_users
|
92
|
+
|
93
|
+
# Constructor
|
94
|
+
#####################################
|
95
|
+
|
96
|
+
# See JSS::APIObject#initialize
|
97
|
+
#
|
98
|
+
def initialize(args = {})
|
99
|
+
super
|
100
|
+
@contact = @init_data[:contact]
|
101
|
+
@service_token = @init_data[:service_token]
|
102
|
+
@account_name = @init_data[:account_name]
|
103
|
+
@expiration_date = @init_data[:expiration_date].to_s.empty? ? nil : Time.parse(@init_data[:expiration_date])
|
104
|
+
@location_name = @init_data[:location_name]
|
105
|
+
@country = @init_data[:country]
|
106
|
+
@apple_id = @init_data[:apple_id]
|
107
|
+
@populate_catalog_from_vpp_content = @init_data[:populate_catalog_from_vpp_content]
|
108
|
+
@notify_disassociation = @init_data[:notify_disassociation]
|
109
|
+
@auto_register_managed_users = @init_data[:auto_register_managed_users]
|
110
|
+
end
|
111
|
+
|
112
|
+
# Public Instance Methods
|
113
|
+
#####################################
|
114
|
+
|
115
|
+
# @param new_val[String] the value
|
116
|
+
#
|
117
|
+
# @return [void]
|
118
|
+
#
|
119
|
+
def contact=(new_val = @contact)
|
120
|
+
return if new_val == @contact
|
121
|
+
|
122
|
+
@contact = JSS::Validate.non_empty_string new_val, 'Contact must be a non-empty String'
|
123
|
+
@need_to_update = true
|
124
|
+
end
|
125
|
+
|
126
|
+
# @param new_val[String] the value
|
127
|
+
#
|
128
|
+
# @return [void]
|
129
|
+
#
|
130
|
+
def country=(new_val = @country)
|
131
|
+
return if new_val == @country
|
132
|
+
|
133
|
+
@country = JSS::Validate.app_store_country_code new_val
|
134
|
+
@need_to_update = true
|
135
|
+
end
|
136
|
+
|
137
|
+
# @param new_val[String] the value
|
138
|
+
#
|
139
|
+
# @return [void]
|
140
|
+
#
|
141
|
+
def apple_id=(new_val = @apple_id)
|
142
|
+
return if new_val == @apple_id
|
143
|
+
|
144
|
+
@apple_id = JSS::Validate.email_address new_val
|
145
|
+
@need_to_update = true
|
146
|
+
end
|
147
|
+
|
148
|
+
# @param new_val[String] the value
|
149
|
+
#
|
150
|
+
# @return [void]
|
151
|
+
#
|
152
|
+
def populate_catalog_from_vpp_content=(new_val = @populate_catalog_from_vpp_content)
|
153
|
+
return if new_val == @populate_catalog_from_vpp_content
|
154
|
+
|
155
|
+
@populate_catalog_from_vpp_content = JSS::Validate.boolean new_val
|
156
|
+
@need_to_update = true
|
157
|
+
end
|
158
|
+
|
159
|
+
# @param new_val[String] the value
|
160
|
+
#
|
161
|
+
# @return [void]
|
162
|
+
#
|
163
|
+
def notify_disassociation=(new_val = @notify_disassociation)
|
164
|
+
return if new_val == @notify_disassociation
|
165
|
+
|
166
|
+
@notify_disassociation = JSS::Validate.boolean new_val
|
167
|
+
@need_to_update = true
|
168
|
+
end
|
169
|
+
|
170
|
+
# @param new_val[String] the value
|
171
|
+
#
|
172
|
+
# @return [void]
|
173
|
+
#
|
174
|
+
def auto_register_managed_users=(new_val = @auto_register_managed_users)
|
175
|
+
return if new_val == @auto_register_managed_users
|
176
|
+
|
177
|
+
@auto_register_managed_users = JSS::Validate.boolean new_val
|
178
|
+
@need_to_update = true
|
179
|
+
end
|
180
|
+
|
181
|
+
# Private Instance Methods
|
182
|
+
#####################################
|
183
|
+
private
|
184
|
+
|
185
|
+
# Return a String with the XML Resource
|
186
|
+
# for submitting creation or changes to the JSS via
|
187
|
+
# the API via the Creatable or Updatable modules
|
188
|
+
#
|
189
|
+
# Most classes will redefine this method.
|
190
|
+
#
|
191
|
+
def rest_xml
|
192
|
+
doc = REXML::Document.new APIConnection::XML_HEADER
|
193
|
+
tmpl = doc.add_element self.class::RSRC_OBJECT_KEY.to_s
|
194
|
+
tmpl.add_element('name').text = @name
|
195
|
+
tmpl.add_element('contact').text = @contact
|
196
|
+
tmpl.add_element('country').text = @country
|
197
|
+
tmpl.add_element('apple_id').text = @apple_id
|
198
|
+
tmpl.add_element('populate_catalog_from_vpp_content').text = @populate_catalog_from_vpp_content.to_s
|
199
|
+
tmpl.add_element('notify_disassociation').text = @notify_disassociation.to_s
|
200
|
+
tmpl.add_element('auto_register_managed_users').text = @auto_register_managed_users.to_s
|
201
|
+
|
202
|
+
add_site_to_xml doc
|
203
|
+
|
204
|
+
doc.to_s
|
205
|
+
end
|
206
|
+
|
207
|
+
end # VPPAccount
|
208
|
+
|
209
|
+
end # JSS
|