ruby-jss 1.2.6 → 1.4.1
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.
- 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
data/lib/jss/api_object/ebook.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")
|
|
@@ -23,12 +23,11 @@
|
|
|
23
23
|
###
|
|
24
24
|
###
|
|
25
25
|
|
|
26
|
-
# This is just a stub for now.
|
|
27
26
|
|
|
28
27
|
#
|
|
29
28
|
module JSS
|
|
30
29
|
|
|
31
|
-
#
|
|
30
|
+
# This is just a stub for now.
|
|
32
31
|
class EBook < APIObject
|
|
33
32
|
|
|
34
33
|
include Sitable
|
|
@@ -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")
|
|
@@ -180,31 +180,21 @@ module JSS
|
|
|
180
180
|
#
|
|
181
181
|
# @return [void]
|
|
182
182
|
#
|
|
183
|
-
def set_ext_attr(
|
|
184
|
-
raise ArgumentError, "Unknown Extension Attribute Name: '#{
|
|
183
|
+
def set_ext_attr(ea_name, value, validate_popup_choice: true, refresh: false)
|
|
184
|
+
raise ArgumentError, "Unknown Extension Attribute Name: '#{ea_name}'" unless ea_types.key? ea_name
|
|
185
185
|
|
|
186
|
-
value
|
|
187
|
-
validate_popup_value(name, value, refresh) if validate_popup_choice
|
|
186
|
+
value = validate_ea_value(ea_name, value, validate_popup_choice, refresh)
|
|
188
187
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
raise JSS::InvalidDataError, "The value for #{name} must be a date, cannot be blank" if value == JSS::BLANK
|
|
192
|
-
|
|
193
|
-
value = JSS.parse_datetime value
|
|
194
|
-
|
|
195
|
-
when *JSS::ExtensionAttribute::NUMERIC_TYPES
|
|
196
|
-
raise JSS::InvalidDataError, "The value for #{name} must be an integer" unless value.is_a? Integer
|
|
188
|
+
# update this ea hash in the @extension_attributes array
|
|
189
|
+
ea_hash = @extension_attributes.find { |ea| ea[:name] == ea_name }
|
|
197
190
|
|
|
198
|
-
|
|
199
|
-
value = value.to_s
|
|
200
|
-
end # case
|
|
191
|
+
raise JSS::NoSuchItemError, "#{self.class} '#{name}'(id #{id}) does not know about ExtAttr '#{ea_name}'. Please re-fetch and try again." unless ea_hash
|
|
201
192
|
|
|
202
|
-
|
|
203
|
-
@extension_attributes.each { |ea| ea[:value] = value if ea[:name] == name }
|
|
193
|
+
ea_hash[:value] = value
|
|
204
194
|
|
|
205
195
|
# update the shortcut hash too
|
|
206
|
-
@ext_attrs[
|
|
207
|
-
@changed_eas <<
|
|
196
|
+
@ext_attrs[ea_name] = value if @ext_attrs
|
|
197
|
+
@changed_eas << ea_name
|
|
208
198
|
@need_to_update = true
|
|
209
199
|
end
|
|
210
200
|
|
|
@@ -248,22 +238,71 @@ module JSS
|
|
|
248
238
|
eaxml
|
|
249
239
|
end
|
|
250
240
|
|
|
251
|
-
#
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
241
|
+
# is the value being passed to set_ext_attr valid?
|
|
242
|
+
# Converts values as needed (e.g. strings to integers or Times)
|
|
243
|
+
#
|
|
244
|
+
# If the EA is defined to hold a string, any value is accepted and
|
|
245
|
+
# converted with #to_s
|
|
246
|
+
#
|
|
247
|
+
# Note: All EAs can be blank
|
|
248
|
+
#
|
|
249
|
+
# @param name[String] the name of the extension attribute to set
|
|
250
|
+
#
|
|
251
|
+
# @param value[String,Time,Integer] the new value for the extension
|
|
252
|
+
# attribute for this user
|
|
253
|
+
#
|
|
254
|
+
# @param validate_popup_choice[Boolean] validate the new value against the E.A. definition.
|
|
255
|
+
# Defaults to true.
|
|
256
|
+
#
|
|
257
|
+
# @param refresh[Boolean] Re-read the ext. attrib definition from the API,
|
|
258
|
+
# for popup validation.
|
|
259
|
+
#
|
|
260
|
+
# @return [Object] the possibly modified valid value
|
|
261
|
+
#
|
|
262
|
+
def validate_ea_value(ea_name, value, validate_popup_choice, refresh)
|
|
263
|
+
return JSS::BLANK if value.to_s == JSS::BLANK
|
|
264
|
+
|
|
265
|
+
value =
|
|
266
|
+
case ea_types[ea_name]
|
|
267
|
+
when JSS::ExtensionAttribute::DATA_TYPE_DATE
|
|
268
|
+
JSS.parse_datetime(value).to_s
|
|
269
|
+
when *JSS::ExtensionAttribute::NUMERIC_TYPES
|
|
270
|
+
validate_integer_ea_value ea_name, value
|
|
271
|
+
else
|
|
272
|
+
value.to_s
|
|
273
|
+
end # case
|
|
274
|
+
|
|
275
|
+
validate_popup_value(ea_name, value, refresh) if validate_popup_choice
|
|
276
|
+
|
|
277
|
+
value
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# raise error if the value isn't an integer
|
|
281
|
+
def validate_integer_ea_value(ea_name, value)
|
|
282
|
+
if value.is_a? Integer
|
|
283
|
+
value
|
|
284
|
+
elsif value.to_s.jss_integer?
|
|
285
|
+
value.to_s.to_i
|
|
286
|
+
else
|
|
287
|
+
raise JSS::InvalidDataError, "The value for #{ea_name} must be an integer"
|
|
288
|
+
end # if
|
|
289
|
+
end
|
|
255
290
|
|
|
291
|
+
# Raise an error if the named EA has a popup menu,
|
|
292
|
+
# but the provided value isn't one of the menu items
|
|
293
|
+
#
|
|
294
|
+
def validate_popup_value(ea_name, value, refresh)
|
|
256
295
|
# get the ea def. instance from the api cache, or the api
|
|
257
296
|
api.ext_attr_definition_cache[self.class] ||= {}
|
|
258
|
-
api.ext_attr_definition_cache[self.class][
|
|
259
|
-
api.ext_attr_definition_cache[self.class][
|
|
297
|
+
api.ext_attr_definition_cache[self.class][ea_name] = nil if refresh
|
|
298
|
+
api.ext_attr_definition_cache[self.class][ea_name] ||= self.class::EXT_ATTRIB_CLASS.fetch name: ea_name, api: api
|
|
260
299
|
|
|
261
|
-
ea_def = api.ext_attr_definition_cache[self.class][
|
|
300
|
+
ea_def = api.ext_attr_definition_cache[self.class][ea_name]
|
|
262
301
|
return unless ea_def.from_popup_menu?
|
|
263
302
|
|
|
264
303
|
return if ea_def.popup_choices.include? value.to_s
|
|
265
304
|
|
|
266
|
-
raise JSS::UnsupportedError, "The value for #{
|
|
305
|
+
raise JSS::UnsupportedError, "The value for #{ea_name} must be one of: '#{ea_def.popup_choices.join("' '")}'"
|
|
267
306
|
end
|
|
268
307
|
|
|
269
308
|
end # module extendable
|
|
@@ -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")
|
|
@@ -179,9 +179,10 @@ module JSS
|
|
|
179
179
|
# deprecated - no longer in the UI
|
|
180
180
|
@recon_display = @init_data[:recon_display] || @web_display
|
|
181
181
|
|
|
182
|
-
#
|
|
183
|
-
#
|
|
184
|
-
|
|
182
|
+
# When used in Advanced Search results, the EA name
|
|
183
|
+
# has colons removed, spaces & dashes turned to underscores.
|
|
184
|
+
# and then ruby-jss symbolizes the name.
|
|
185
|
+
@symbolized_name = @name.gsub(':', '').gsub(/-| /, '_').to_sym
|
|
185
186
|
end # init
|
|
186
187
|
|
|
187
188
|
# Public Instance Methods
|
data/lib/jss/api_object/group.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")
|
|
@@ -22,15 +22,19 @@
|
|
|
22
22
|
### language governing permissions and limitations under the Apache License.
|
|
23
23
|
###
|
|
24
24
|
|
|
25
|
-
# This is just a stub for now.
|
|
26
|
-
|
|
27
|
-
#
|
|
28
25
|
module JSS
|
|
29
26
|
|
|
30
|
-
#
|
|
31
|
-
class MacApplication < APIObject
|
|
27
|
+
# This is just a stub for now.
|
|
28
|
+
class MacApplication < JSS::APIObject
|
|
32
29
|
|
|
33
|
-
|
|
30
|
+
# Mix-Ins
|
|
31
|
+
#####################################
|
|
32
|
+
include JSS::Updatable
|
|
33
|
+
include JSS::Scopable
|
|
34
|
+
include JSS::SelfServable
|
|
35
|
+
include JSS::Categorizable
|
|
36
|
+
include JSS::VPPable
|
|
37
|
+
include JSS::Sitable
|
|
34
38
|
|
|
35
39
|
### The base for REST resources of this class
|
|
36
40
|
RSRC_BASE = 'macapplications'.freeze
|
|
@@ -47,9 +51,104 @@ module JSS
|
|
|
47
51
|
# See {APIObject#add_object_history_entry}
|
|
48
52
|
OBJECT_HISTORY_OBJECT_TYPE = 350
|
|
49
53
|
|
|
54
|
+
# See JSS::Scopable
|
|
55
|
+
SCOPE_TARGET_KEY = :computers
|
|
56
|
+
|
|
57
|
+
# Where is the Category in the API JSON?
|
|
58
|
+
CATEGORY_SUBSET = :general
|
|
59
|
+
|
|
60
|
+
# How is the category stored in the API data?
|
|
61
|
+
CATEGORY_DATA_TYPE = Hash
|
|
62
|
+
|
|
50
63
|
# Where is the Site data in the API JSON?
|
|
51
64
|
SITE_SUBSET = :general
|
|
52
65
|
|
|
53
|
-
|
|
66
|
+
# Attributes
|
|
67
|
+
#############################################
|
|
68
|
+
|
|
69
|
+
# @return [String]
|
|
70
|
+
attr_reader :version
|
|
71
|
+
|
|
72
|
+
# @return [Boolean]
|
|
73
|
+
attr_reader :is_free
|
|
74
|
+
alias free? is_free
|
|
75
|
+
|
|
76
|
+
# @return [String]
|
|
77
|
+
attr_reader :bundle_id
|
|
78
|
+
|
|
79
|
+
# @return [String]
|
|
80
|
+
attr_reader :url
|
|
81
|
+
|
|
82
|
+
## Constructor
|
|
83
|
+
#####################################
|
|
84
|
+
|
|
85
|
+
def initialize(args = {})
|
|
86
|
+
super
|
|
87
|
+
general = @init_data[:general]
|
|
88
|
+
@version = general[:version]
|
|
89
|
+
@is_free = general[:is_free]
|
|
90
|
+
@bundle_id = general[:bundle_id]
|
|
91
|
+
@url = general[:url]
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Overrides, because consistency isn't alway a thing in the
|
|
95
|
+
# classic API
|
|
96
|
+
#############################################
|
|
97
|
+
|
|
98
|
+
# Override self_service_display_name getter
|
|
99
|
+
def self_service_display_name
|
|
100
|
+
raise JSS::UnsupportedError, 'MacApplications do not have separate display names. Please use the object name.'
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Override self_service_display_name setter
|
|
104
|
+
def self_service_display_name=(_newname)
|
|
105
|
+
raise JSS::UnsupportedError, 'MacApplications do not have separate display names. Please use the object name.'
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Override reinstall_button_text getter
|
|
109
|
+
def reinstall_button_text
|
|
110
|
+
raise JSS::UnsupportedError, 'MacApplications do not have separate text for reinstall buttons. Please use install_button_text.'
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Override reinstall_button_text setter
|
|
114
|
+
def reinstall_button_text=(_new)
|
|
115
|
+
raise JSS::UnsupportedError, 'MacApplications do not have separate text for reinstall buttons. Please use install_button_text.'
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Alas, SSvc icons are not uploadable via the API for
|
|
119
|
+
# mac apps
|
|
120
|
+
def upload(_type, _local_file)
|
|
121
|
+
raise JSS::UnsupportedError, 'The Classic API does not support uploading icons for MacApplications. Please use the Web UI'
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
## Private Instance Methods
|
|
125
|
+
#####################################
|
|
126
|
+
private
|
|
127
|
+
|
|
128
|
+
### Return the xml for creating or updating this script in the JSS
|
|
129
|
+
###
|
|
130
|
+
def rest_xml
|
|
131
|
+
doc = REXML::Document.new APIConnection::XML_HEADER
|
|
132
|
+
obj = doc.add_element RSRC_OBJECT_KEY.to_s
|
|
133
|
+
|
|
134
|
+
general = obj.add_element('general')
|
|
135
|
+
|
|
136
|
+
general.add_element('version').text = @version
|
|
137
|
+
general.add_element('is_free').text = @is_free.to_s
|
|
138
|
+
general.add_element('bundle_id').text = @bundle_id
|
|
139
|
+
general.add_element('url').text = @url
|
|
140
|
+
|
|
141
|
+
obj << @scope.scope_xml
|
|
142
|
+
|
|
143
|
+
add_self_service_xml doc
|
|
144
|
+
add_category_to_xml doc
|
|
145
|
+
add_site_to_xml doc
|
|
146
|
+
add_vpp_xml doc
|
|
147
|
+
|
|
148
|
+
doc.to_s
|
|
149
|
+
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
end # class MacApplication
|
|
54
153
|
|
|
55
|
-
end
|
|
154
|
+
end # Module JSS
|