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
|
@@ -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")
|
|
@@ -26,9 +26,16 @@
|
|
|
26
26
|
###
|
|
27
27
|
module JSS
|
|
28
28
|
|
|
29
|
-
# A mix-in module to
|
|
29
|
+
# A mix-in module to handleVPP-related data in API objects that can be
|
|
30
30
|
# assigned via VPP.
|
|
31
31
|
#
|
|
32
|
+
# NOTE: For now we are only working with device-based VPP assignments,
|
|
33
|
+
# which are done via the scope of the VPPable object (macapp, mobdevapp, ebook)
|
|
34
|
+
#
|
|
35
|
+
# User-based APP assignments will require the creation of a VPPAssignment class,
|
|
36
|
+
# and a VPPAssignmentScope class, since those scopes are very limited compared
|
|
37
|
+
# to ordinary scope.
|
|
38
|
+
#
|
|
32
39
|
# To use this module, merely `include VPPable` when defining your
|
|
33
40
|
# subclass of JSS::APIObject
|
|
34
41
|
#
|
|
@@ -40,6 +47,50 @@ module JSS
|
|
|
40
47
|
#####################################
|
|
41
48
|
VPPABLE = true
|
|
42
49
|
|
|
50
|
+
# Mixed-in Class Methods
|
|
51
|
+
#
|
|
52
|
+
# This is a common technique to get class methods mixed in when
|
|
53
|
+
# you 'include' a module full of instance methods
|
|
54
|
+
#####################################
|
|
55
|
+
|
|
56
|
+
def self.included(klass)
|
|
57
|
+
klass.extend(ClassMethods)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Methods in here will become class methods of the
|
|
61
|
+
# classes that include VPPable
|
|
62
|
+
module ClassMethods
|
|
63
|
+
|
|
64
|
+
# The names and assignment data for all class members that have
|
|
65
|
+
# VPP licenses that can be assigned by device.
|
|
66
|
+
# The assignment data is a hash of three keys pointing to integers:
|
|
67
|
+
# {
|
|
68
|
+
# total: int,
|
|
69
|
+
# used: int,
|
|
70
|
+
# remaining: int
|
|
71
|
+
# }
|
|
72
|
+
#
|
|
73
|
+
# WARNING: This must instantiate all objects, so is slow
|
|
74
|
+
#
|
|
75
|
+
# @return [Hash{String=>Hash}] The names and assignment data
|
|
76
|
+
def all_vpp_device_assignable
|
|
77
|
+
data = {}
|
|
78
|
+
all_ids.each do |id|
|
|
79
|
+
obj = fetch id: id
|
|
80
|
+
next unless obj.vpp_device_based?
|
|
81
|
+
|
|
82
|
+
data[obj.name] = {
|
|
83
|
+
total: obj.vpp_licenses_total,
|
|
84
|
+
used: obj.vpp_licenses_used,
|
|
85
|
+
remaining: obj.vpp_licenses_remaining
|
|
86
|
+
}
|
|
87
|
+
end
|
|
88
|
+
data
|
|
89
|
+
end # all_vpp_device_assignable
|
|
90
|
+
|
|
91
|
+
end # module ClassMethods
|
|
92
|
+
|
|
93
|
+
|
|
43
94
|
# Mixed-in Attributes
|
|
44
95
|
#####################################
|
|
45
96
|
|
|
@@ -48,6 +99,7 @@ module JSS
|
|
|
48
99
|
|
|
49
100
|
# @return [Integer]
|
|
50
101
|
attr_reader :vpp_admin_account_id
|
|
102
|
+
alias vpp_account_id vpp_admin_account_id
|
|
51
103
|
|
|
52
104
|
# @return [Boolean]
|
|
53
105
|
attr_reader :assign_vpp_device_based_licenses
|
|
@@ -55,8 +107,7 @@ module JSS
|
|
|
55
107
|
|
|
56
108
|
# @return [Integer]
|
|
57
109
|
attr_reader :total_vpp_licenses
|
|
58
|
-
alias
|
|
59
|
-
alias vpp_license_count total_vpp_licenses
|
|
110
|
+
alias vpp_licenses_total total_vpp_licenses
|
|
60
111
|
|
|
61
112
|
# @return [Integer]
|
|
62
113
|
attr_reader :remaining_vpp_licenses
|
|
@@ -66,22 +117,126 @@ module JSS
|
|
|
66
117
|
attr_reader :used_vpp_licenses
|
|
67
118
|
alias vpp_licenses_used used_vpp_licenses
|
|
68
119
|
|
|
120
|
+
#### How to assign VPP content & view assignments
|
|
121
|
+
#
|
|
122
|
+
# When doing device-based assignments, they are made via the
|
|
123
|
+
# Scope of the VPPable Object.
|
|
124
|
+
#
|
|
125
|
+
# There is no indication in the device's API data that an app/book was
|
|
126
|
+
# installed/licensed via VPP, it just shows up in the
|
|
127
|
+
# list of installed apps like any other.
|
|
128
|
+
#
|
|
129
|
+
# When doing user-based assignments, they are made via the (limited)
|
|
130
|
+
# scope of a 'Volume Assignment' object in Users -> Volume Assignement
|
|
131
|
+
# These objects are sort of like policies or config profiles in that they have
|
|
132
|
+
# payloads, and can assign multiple things at once (iosapps, macapps, ebooks)
|
|
133
|
+
# These are available as vppassignment objects in the API.
|
|
134
|
+
#
|
|
135
|
+
# User-based assignments show up in the User's Jamf record
|
|
136
|
+
# Users -> username -> (vpp acct name)
|
|
137
|
+
# There you'll see the names of objects assigned to the user, and the
|
|
138
|
+
# devices on which they've accepted the VPP invitation. In the User's
|
|
139
|
+
# API data, there isaa 'vpp_assignments' arry of hash's like this:
|
|
140
|
+
# [{:id=>13733, :uid=>"258_13733"}]
|
|
141
|
+
# However, that 'id' is not the id of any known vppassignment object, and
|
|
142
|
+
# the uid is... ?? The object model at Developer.jamf.com says those
|
|
143
|
+
# values should be an id and a name, probably pointing to a vppassignment
|
|
144
|
+
# object, but that isn't the case.
|
|
145
|
+
#
|
|
146
|
+
#
|
|
147
|
+
#### Figuring out how many, and where VPP lic. are used....
|
|
148
|
+
#
|
|
149
|
+
# IF dev. based assignement is turned on, then
|
|
150
|
+
# the VPPable object (app, ebook) in the API will show the total numbers
|
|
151
|
+
# of both user and device based assignments:
|
|
152
|
+
#
|
|
153
|
+
# "vpp": {
|
|
154
|
+
# "assign_vpp_device_based_licenses": true,
|
|
155
|
+
# "vpp_admin_account_id": 1,
|
|
156
|
+
# "total_vpp_licenses": 2,
|
|
157
|
+
# "remaining_vpp_licenses": 0,
|
|
158
|
+
# "used_vpp_licenses": 2
|
|
159
|
+
# }
|
|
160
|
+
#
|
|
161
|
+
# However, if assign_vpp_device_based_licenses is false, meaning
|
|
162
|
+
# all assignments are user-based, then no other info is shown in the API.
|
|
163
|
+
#
|
|
164
|
+
# In that case, in the UI, you can see the total assignments in a table
|
|
165
|
+
# in Settings -> Global Mgmt -> Volume Purch -> Content -> (ios/mac)
|
|
166
|
+
# The numbers shown there indicate all assignments, whether user- or
|
|
167
|
+
# deviced-based, just like the numbers in the API data for the VPPable
|
|
168
|
+
# object, if they are there.
|
|
169
|
+
# But there's no equivalent for that table data directly in the API when
|
|
170
|
+
# device-based is false.
|
|
171
|
+
#
|
|
172
|
+
# Also in the UI you can see the intividual computers, mobiledevs, and users
|
|
173
|
+
# to whom an object is assigned, no matter how it was assigned. Go to
|
|
174
|
+
# Users -> Volume Assignments -> [any assigment object] -> Apps/Books -> ios/mac
|
|
175
|
+
# and click on the number in the rightmost 'in use' column, and you'll
|
|
176
|
+
# see a page with 3 tabs, showing the individual computers, mobdevs, or users
|
|
177
|
+
# with the app/ebook assigned. EXCEPT this doesn't seem to expand
|
|
178
|
+
# scoped groups - when I added a static computer group with one computer to
|
|
179
|
+
# the scope of a MacApp, the total in-use count went up from 6 to 7, but the
|
|
180
|
+
# list of computers two which it was assigned still showed only 6. :-(
|
|
181
|
+
#
|
|
182
|
+
# You can also get to the same page via: Users->SeachVolumeContent
|
|
183
|
+
# then perform a simple search, and in the results page, click on the in-use
|
|
184
|
+
# number. If you click on the VolumeAssignments number you'll see a
|
|
185
|
+
# breakdown of the device assignments (from the app itself) and user assignments
|
|
186
|
+
# and their scopes, but the scopes will not expand any groups, just list them.
|
|
187
|
+
#
|
|
188
|
+
# So 2 questions:
|
|
189
|
+
# 1) How to see the total/used/remaining licenses for a VPPable object in the
|
|
190
|
+
# API, regardless of how it's deployed
|
|
191
|
+
#
|
|
192
|
+
# - first look at the VPPable object, and if the data is there, yer done.
|
|
193
|
+
# - If not, then the object is only assigned to users, so we can loop thru
|
|
194
|
+
# the vppassignment objects and count things up.
|
|
195
|
+
#
|
|
196
|
+
# 2) How to learn where the VPPable object is actually assigned - i.e.
|
|
197
|
+
# a list of users and/or devices. Note: this isn't a list of where it's
|
|
198
|
+
# installed, but to whom/where it is assigned.
|
|
199
|
+
#
|
|
200
|
+
# - TLDR: no scopable object in Jamf gives you such a list, so we probably
|
|
201
|
+
# don't need it.
|
|
202
|
+
#
|
|
203
|
+
# In the UI, the page you get when clicking the 'in use' column of various
|
|
204
|
+
# 'volume content' lists (see above) gets you the individually assigned
|
|
205
|
+
# hardware or users, but doesn't show those via groups.
|
|
206
|
+
# In the API - there doesn't seem to be any access at all, other than the
|
|
207
|
+
# scopes of the VPPable Object itself, and any vppassignments that contain it.
|
|
208
|
+
# Scanning through them is probably the only option, but could be slow once
|
|
209
|
+
# there are many - and expanding those scopes into an actual list of users
|
|
210
|
+
# and devices would be a pain to write
|
|
211
|
+
#
|
|
212
|
+
|
|
213
|
+
# Mixed-in Instance Methods
|
|
214
|
+
#####################################
|
|
69
215
|
|
|
70
216
|
# Set whether or not the VPP licenses should be assigned
|
|
71
|
-
# by device
|
|
217
|
+
# by device as well as (or.. instead of?) by user
|
|
72
218
|
#
|
|
73
219
|
# @param new_val[Boolean] The new value
|
|
74
220
|
#
|
|
75
221
|
# @return [void]
|
|
76
222
|
#
|
|
77
223
|
def assign_vpp_device_based_licenses=(new_val)
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
@assign_vpp_device_based_licenses = new_val
|
|
224
|
+
return if new_val == @assign_vpp_device_based_licenses
|
|
225
|
+
|
|
226
|
+
@assign_vpp_device_based_licenses = JSS::Validate.boolean new_val
|
|
81
227
|
@need_to_update = true
|
|
82
228
|
end
|
|
83
229
|
alias vpp_device_based= assign_vpp_device_based_licenses=
|
|
84
230
|
|
|
231
|
+
# @return [String] The name of the vpp admin acct for this object
|
|
232
|
+
#
|
|
233
|
+
def vpp_admin_account_name
|
|
234
|
+
return unless @vpp_admin_account_id.is_a? Integer
|
|
235
|
+
|
|
236
|
+
JSS::VPPAccount.map_all_ids_to(:name)[@vpp_admin_account_id]
|
|
237
|
+
end
|
|
238
|
+
alias vpp_account_name vpp_admin_account_name
|
|
239
|
+
|
|
85
240
|
# Mixed-in Private Instance Methods
|
|
86
241
|
#####################################
|
|
87
242
|
private
|
|
@@ -92,11 +247,12 @@ module JSS
|
|
|
92
247
|
#
|
|
93
248
|
def parse_vpp
|
|
94
249
|
@vpp_codes = @init_data[:vpp_codes]
|
|
95
|
-
|
|
96
|
-
@
|
|
97
|
-
@
|
|
98
|
-
@
|
|
99
|
-
@
|
|
250
|
+
vpp_data = @init_data[:vpp]
|
|
251
|
+
@vpp_admin_account_id = vpp_data[:vpp_admin_account_id]
|
|
252
|
+
@assign_vpp_device_based_licenses = vpp_data[:assign_vpp_device_based_licenses]
|
|
253
|
+
@total_vpp_licenses = vpp_data[:total_vpp_licenses]
|
|
254
|
+
@remaining_vpp_licenses = vpp_data[:remaining_vpp_licenses]
|
|
255
|
+
@used_vpp_licenses = vpp_data[:used_vpp_licenses]
|
|
100
256
|
end
|
|
101
257
|
|
|
102
258
|
# Insert an appropriate vpp element into the XML for sending changes
|
|
@@ -109,7 +265,7 @@ module JSS
|
|
|
109
265
|
def add_vpp_xml(xdoc)
|
|
110
266
|
doc_root = xdoc.root
|
|
111
267
|
vpp = doc_root.add_element 'vpp'
|
|
112
|
-
vpp.add_element('assign_vpp_device_based_licenses').text = @assign_vpp_device_based_licenses
|
|
268
|
+
vpp.add_element('assign_vpp_device_based_licenses').text = @assign_vpp_device_based_licenses.to_s
|
|
113
269
|
end
|
|
114
270
|
|
|
115
271
|
end # VPPable
|
data/lib/jss/client.rb
CHANGED
data/lib/jss/compatibility.rb
CHANGED
data/lib/jss/composer.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")
|
|
@@ -147,7 +147,7 @@ module JSS
|
|
|
147
147
|
|
|
148
148
|
### now build the pkg
|
|
149
149
|
begin
|
|
150
|
-
it_built = system "#{PKGBUILD} --identifier '#{pkg_id}' --version '#{version}' --ownership #{pkg_ownership} --install-location / --root '#{root}' #{signing} #{comp_plist_arg} '#{pkg_out}'
|
|
150
|
+
it_built = system "#{PKGBUILD} --identifier '#{pkg_id}' --version '#{version}' --ownership #{pkg_ownership} --install-location / --root '#{root}' #{signing} #{comp_plist_arg} '#{pkg_out}'"
|
|
151
151
|
|
|
152
152
|
raise 'There was an error building the .pkg' unless it_built
|
|
153
153
|
ensure
|
data/lib/jss/configuration.rb
CHANGED
data/lib/jss/db_connection.rb
CHANGED
data/lib/jss/exceptions.rb
CHANGED
data/lib/jss/ruby_extensions.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")
|
|
@@ -29,10 +29,11 @@ module JSSRubyExtensions
|
|
|
29
29
|
|
|
30
30
|
module Predicates
|
|
31
31
|
|
|
32
|
-
INTEGER_RE = /\A[0-9]+\Z/.freeze
|
|
32
|
+
INTEGER_RE = /\A-?[0-9]+\Z/.freeze
|
|
33
|
+
FLOAT_RE = /\A-?[0-9]+\.[0-9]+\Z/.freeze
|
|
33
34
|
|
|
34
|
-
# Is this string also
|
|
35
|
-
# (i.e. it consists only of numberic digits)
|
|
35
|
+
# Is this string also an integer?
|
|
36
|
+
# (i.e. it consists only of numberic digits, maybe with a dash in front)
|
|
36
37
|
#
|
|
37
38
|
# @return [Boolean]
|
|
38
39
|
#
|
|
@@ -40,6 +41,15 @@ module JSSRubyExtensions
|
|
|
40
41
|
self =~ INTEGER_RE ? true : false
|
|
41
42
|
end
|
|
42
43
|
|
|
44
|
+
# Is this string also a floar?
|
|
45
|
+
# (i.e. it consists only of numberic digits)
|
|
46
|
+
#
|
|
47
|
+
# @return [Boolean]
|
|
48
|
+
#
|
|
49
|
+
def jss_float?
|
|
50
|
+
self =~ FLOAT_RE ? true : false
|
|
51
|
+
end
|
|
52
|
+
|
|
43
53
|
end # module
|
|
44
54
|
|
|
45
55
|
end # module
|
data/lib/jss/server.rb
CHANGED
data/lib/jss/utility.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")
|
|
@@ -32,7 +32,7 @@ module JSS
|
|
|
32
32
|
|
|
33
33
|
# Converts an OS Version into an Array of higher OS versions.
|
|
34
34
|
#
|
|
35
|
-
# It's unlikely that this library will still be in use as-is by the release of OS X 10.
|
|
35
|
+
# It's unlikely that this library will still be in use as-is by the release of OS X 10.30.
|
|
36
36
|
# Hopefully well before then JAMF will implement a "minimum OS" in the JSS itself.
|
|
37
37
|
#
|
|
38
38
|
# @param min_os [String] the mimimum OS version to expand, e.g. ">=10.6.7" or "10.6.7"
|
|
@@ -43,26 +43,12 @@ module JSS
|
|
|
43
43
|
# JSS.expand_min_os ">=10.6.7" # => returns this array
|
|
44
44
|
# # ["10.6.7",
|
|
45
45
|
# # "10.6.8",
|
|
46
|
-
# #
|
|
47
|
-
# # "10.6.
|
|
48
|
-
# # "10.6.11",
|
|
49
|
-
# # "10.6.12",
|
|
50
|
-
# # "10.6.13",
|
|
51
|
-
# # "10.6.14",
|
|
52
|
-
# # "10.6.15",
|
|
46
|
+
# # ...
|
|
47
|
+
# # "10.6.25",
|
|
53
48
|
# # "10.7.x",
|
|
54
49
|
# # "10.8.x",
|
|
55
|
-
# #
|
|
56
|
-
# # "10.
|
|
57
|
-
# # "10.11.x",
|
|
58
|
-
# # "10.12.x",
|
|
59
|
-
# # "10.13.x",
|
|
60
|
-
# # "10.14.x",
|
|
61
|
-
# # "10.15.x",
|
|
62
|
-
# # "10.16.x",
|
|
63
|
-
# # "10.17.x",
|
|
64
|
-
# # "10.18.x",
|
|
65
|
-
# # "10.19.x"]
|
|
50
|
+
# # ...
|
|
51
|
+
# # "10.30.x"]
|
|
66
52
|
#
|
|
67
53
|
#
|
|
68
54
|
def self.expand_min_os(min_os)
|
|
@@ -80,14 +66,14 @@ module JSS
|
|
|
80
66
|
# (and hope apple doesn't do more than 15 maint releases for an OS)
|
|
81
67
|
else
|
|
82
68
|
ok_oses = []
|
|
83
|
-
(maint.to_i..
|
|
69
|
+
(maint.to_i..25).each do |m|
|
|
84
70
|
ok_oses << maj + '.' + min + '.' + m.to_s
|
|
85
71
|
end # each m
|
|
86
72
|
end
|
|
87
73
|
|
|
88
74
|
# now account for all OS X versions starting with 10.
|
|
89
|
-
# up to
|
|
90
|
-
((min.to_i + 1)..
|
|
75
|
+
# up to 10.30.x
|
|
76
|
+
((min.to_i + 1)..30).each do |v|
|
|
91
77
|
ok_oses << maj + '.' + v.to_s + '.x'
|
|
92
78
|
end # each v
|
|
93
79
|
ok_oses
|