ruby-jss 1.2.4a3 → 1.3.2
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 +180 -1
- data/README.md +4 -2
- 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 +2 -1
- data/lib/jamf/api/abstract_classes/advanced_search.rb +1 -1
- data/lib/jamf/api/abstract_classes/collection_resource.rb +54 -38
- data/lib/jamf/api/abstract_classes/generic_reference.rb +1 -1
- data/lib/jamf/api/abstract_classes/json_object.rb +16 -10
- data/lib/jamf/api/abstract_classes/prestage.rb +111 -35
- 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 +166 -69
- 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 +87 -16
- 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 +6 -4
- 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 +5 -3
- 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 +3 -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 +3 -3
- 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 -1
- data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +110 -18
- data/lib/jamf/api/resources/collection_resources/extension_attribute.rb +1 -1
- data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +9 -2
- 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 +119 -0
- 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 +59 -4
- 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 +6 -8
- data/lib/jamf/exceptions.rb +6 -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 -3
- 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 +5 -2
- data/lib/jss/api_connection.rb +3 -30
- data/lib/jss/api_object.rb +16 -3
- data/lib/jss/api_object/account.rb +1 -1
- data/lib/jss/api_object/advanced_search.rb +1 -1
- 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/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 +10 -5
- data/lib/jss/api_object/criteriable/criteria.rb +26 -10
- 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 +1 -1
- data/lib/jss/api_object/extendable.rb +67 -28
- data/lib/jss/api_object/extension_attribute.rb +1 -1
- 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 +1 -1
- data/lib/jss/api_object/management_history.rb +23 -22
- 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 +29 -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 +107 -42
- 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 +380 -5
- 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 +257 -37
- data/lib/jss/api_object/script.rb +1 -1
- data/lib/jss/api_object/self_servable.rb +7 -7
- data/lib/jss/api_object/self_servable/icon.rb +1 -1
- data/lib/jss/api_object/sitable.rb +6 -2
- 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 +1 -1
- data/lib/jss/api_object/user.rb +5 -3
- data/lib/jss/api_object/vppable.rb +1 -1
- 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 +1 -1
- 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 +16 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa838d9a9f35421383049454edc0add9cac32ce63adffdeeaa968b82a7553ab3
|
4
|
+
data.tar.gz: c26dd00287dbafb8cf573d0a610183e6110032cd5e0726d07290096861330fc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17dbb8ba3b2da2d781b9218eb8491f7f6c627e8ed97a275589be3e62a57bd2cbab572af4f3621611c03c10f430312256fdb6faab14dbb61a5ba7e60076caebfa
|
7
|
+
data.tar.gz: 93c6c8bd3c8db99e7de2f40f3234cfeb83a0a517495251bbf99b60f597ef3a6b7b59cbd6ca4997d35b7a1a07a9fdcf3c42b367da28797d44b08467060f4ce6cc
|
data/CHANGES.md
CHANGED
@@ -4,6 +4,184 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## \[1.3.2] - 2020-07-31
|
8
|
+
Many thanks to @cybertunnel for adding a huge amount of code to get JSS::Policy fully implimented, as well as other fixes and updates!
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- new class JSS::DockItem
|
12
|
+
- new classes JSS::DirectoryBinding and JSS::DirectoryBindingType
|
13
|
+
- new class JSS::Printer
|
14
|
+
- new class JSS::DiskEncryptionConfiguration
|
15
|
+
- JSS::Policy:
|
16
|
+
- getters and setters for `#user_message_start` and `#user_message_end`
|
17
|
+
- `#set_management_account` and `#verify_management_password`
|
18
|
+
- `#add_dock_item` and `#remove_dock_item`
|
19
|
+
- `#directory_bindings`, `#add_directory_binding` and `#remove_directory_binding`
|
20
|
+
- `#add_printer` and `#remove_printer`
|
21
|
+
- `#reissue_key`, `#apply_encryption_configuration`, and `#remove_encryption_configuration`
|
22
|
+
|
23
|
+
|
24
|
+
### Changed
|
25
|
+
- JSS::Package:
|
26
|
+
- no longer issues a warning when changing the file_name of a package
|
27
|
+
- Updated the CPU type string from 'x86' to 'Intel/x86'
|
28
|
+
- Methods which used to always use the master distribution point now accept a parameter `dist_point: dp` where dp is the name or id of a fileshare distribution point. If not specified, it still defaults to the Master Distribution Point. This is needed because if the Cloud Distribution Point is the master, there is no access to it via the Classic API, and any use of DistributionPoint.master_distribution_point will raise an error.
|
29
|
+
|
30
|
+
## \[1.3.1] - 2020-06-21
|
31
|
+
|
32
|
+
### Changed
|
33
|
+
|
34
|
+
- JSS::MobileDeviceApplication when using PrettyPrint (pp) in irb, no longer shows the base64 data for the ipa file.
|
35
|
+
|
36
|
+
- JSS::DistributionPoint.my_distribution_point and .master_distribution_point now have options for dealing with the Cloud Distribution Point (which is not available in the classic API) being the master.
|
37
|
+
|
38
|
+
### Fixed
|
39
|
+
|
40
|
+
- JSS::NetworkSegment.distribution_point= now takes nil or an empty string to unset the dist point.
|
41
|
+
|
42
|
+
## \[1.3.0] - 2020-06-05
|
43
|
+
|
44
|
+
### Added
|
45
|
+
|
46
|
+
- JSS::NetworkSegment.network_ranges_as_integers method, Similar to NetworkSegment.network_ranges, but the ranges are of Integers, not IPAddr instances. This makes for *MUCH* faster range calculations, needed to implement improvements to NetworkSegment.network_segment_for_ip
|
47
|
+
|
48
|
+
- JSS::Package.all_filenames_by, returns a Hash of all distribution point filenames for all packages, keyed by either the package id, or the package name. NOTE: as with JSS::Package.all_filenames, this method must instantiate all JSS::Package objects, so it will be slow.
|
49
|
+
|
50
|
+
### Changed
|
51
|
+
|
52
|
+
- JSS.expand_min_os now expands to macOS 10.30.x, which should hold us for a while
|
53
|
+
|
54
|
+
- JSS::NetworkSegment.network_segment_for_ip and .my_network_segment are no longer deprecated, but now return an integer NetSeg id (or nil). The plural forms of those methods still return an Array of ids for all the matching network segments.
|
55
|
+
|
56
|
+
- The logic for JSS::NetworkSegment.network_segment_for_ip (and .my_network_segment) now matches how the Jamf server does it: when you IP address is in more than one Network Segment, Jamf uses the smallest/narrowest one (the one containing fewest IP addresses). If more than one of your Network Segments are that same width, the one with the lowest starting IP address is used.
|
57
|
+
|
58
|
+
- In some networking situations (e.g. Split-tunnel VPN with multiple active network ports) the JSS::APIObject.delete method will raise a 404 NotFound error, seemingly because the object was already deleted but a second http DELETE is sent (I think). We now just rescue and ignore that error, since the fact that it's not found means it was indeed deleted.
|
59
|
+
|
60
|
+
### Fixed
|
61
|
+
|
62
|
+
- A copy/paste bug in Jamf::Prestage.serials_for_prestage
|
63
|
+
|
64
|
+
## \[1.2.15] - 2020-04-30
|
65
|
+
|
66
|
+
### Fixed
|
67
|
+
|
68
|
+
- USER_CONF_FILE is always a pathname, never nil
|
69
|
+
|
70
|
+
- issues with Array#j_ci_* methods related to removing safe navigation
|
71
|
+
|
72
|
+
## \[1.2.13] - 2020-04-29
|
73
|
+
|
74
|
+
### Fixed
|
75
|
+
|
76
|
+
- Ruby 2.6 needs parens in more places than 2.3, apparently
|
77
|
+
|
78
|
+
## \[1.2.12] - 2020-04-29
|
79
|
+
|
80
|
+
### Added
|
81
|
+
|
82
|
+
- Backport of `#dig` for Arrays, Hashes and OpenStructs, for compatibiliy with older rubiesd (for a while longer anyway). Gratefully borrowed from https://github.com/Invoca/ruby_dig
|
83
|
+
|
84
|
+
### Changed
|
85
|
+
|
86
|
+
- Removed all safe navigation operators (`&.`) for compatibility with older rubies (for a while longer anyway)
|
87
|
+
|
88
|
+
|
89
|
+
## \[1.2.11] - 2020-04-26
|
90
|
+
|
91
|
+
### Fixed
|
92
|
+
|
93
|
+
- Bug in Package#install that prevented installs from 'alt_download_url'.
|
94
|
+
|
95
|
+
## \[1.2.10] - 2020-04-25
|
96
|
+
|
97
|
+
### Added
|
98
|
+
|
99
|
+
- Computer#reported_ip_address. This value is collected in newer versions of Jamf Pro. While the #ip_address is the client's IP address from the Jamf Server's perspective, the #reported_ip_address is the IP from the client's perspective, which may be different on a NATted network like a home network.
|
100
|
+
|
101
|
+
### Fixed
|
102
|
+
|
103
|
+
- MobileDevice#upload now works like Computer#upload
|
104
|
+
|
105
|
+
### Changed
|
106
|
+
|
107
|
+
- Validation of Ext. Attribute values is improved, namely for EAs with integer values, integer-strings like "12" are accepted and converted to real integers as needed.
|
108
|
+
|
109
|
+
## \[1.2.9] - 2020-04-13
|
110
|
+
|
111
|
+
### Fixed
|
112
|
+
|
113
|
+
- Fixed a bug where passing a frozen string into some setters, e.g. `JSS::Computer.asset_tag=`, would cause an error when it tried to `#strip!` the string.
|
114
|
+
|
115
|
+
## \[1.2.8] - 2020-04-12
|
116
|
+
|
117
|
+
### Added
|
118
|
+
|
119
|
+
- MobileDevice#update now takes the `no_mdm_rename:` boolean parameter. Prevents an MDM rename command being sent when changing the name of a supervised device with enforced names. Useful when the MDM command fails, as when there's already a pending rename command.
|
120
|
+
|
121
|
+
- `String#jss_float?` and `String#j_float?` predicate methods.
|
122
|
+
|
123
|
+
### Changed
|
124
|
+
|
125
|
+
- Jamf Pro API endpoints that have paging options have an undocumented max page size of 2000. The `CollectionResource#all*` methods now account for this.
|
126
|
+
|
127
|
+
- `String#jss_integer?` and `String#j_integer?` now recognize negative integers
|
128
|
+
|
129
|
+
- Ext. Attributes defined to have interger values will now accept integer strings, e.g. `'12345'` as well as integers e.g. `12345`
|
130
|
+
|
131
|
+
- Ext. Attributes defined to have date values will once again accept blanks (i.e. empty strings)
|
132
|
+
|
133
|
+
## \[1.2.7] - 2020-04-01
|
134
|
+
|
135
|
+
### Changed
|
136
|
+
|
137
|
+
- Jamf Pro API endpoints that have paging options have an undocumented max page size of 2000. The `CollectionResource#all*` methods now account for this.
|
138
|
+
|
139
|
+
|
140
|
+
## \[1.2.6] - 2020-04-01
|
141
|
+
|
142
|
+
### Fixed
|
143
|
+
|
144
|
+
- Classic API (JSS module)
|
145
|
+
- Sitable objects now recognize the string "None" as meaning no site is assigned. Thanks @cybertunnel for this fix!
|
146
|
+
|
147
|
+
- Scopable::Scope now deals with some bugs in the API regarding Jamf & LDAP users & user groups in targets, limitations, & exclusions. Please see the documentation/comments for the class in the file or the online documentation. Thanks @cybertunnel again!
|
148
|
+
|
149
|
+
- Criteriable::Criteria can now be empty - containing no criterion objects. When criteriable objects are created (such as Advanced Searches) the default JSS::Criteriable::Criteria object has no criteria. To remove all criteria, use `criteria.clear`, `criteria = nil`, or `criteria = JSS::Criteriable::Criteria.new` and then save. Once again, thanks to @cybertunnel for finding this.
|
150
|
+
|
151
|
+
- Jamf Pro API (Jamf module)
|
152
|
+
- More fixes for various JamfPro API (Jamf module) methods that accept a passed-in Jamf::Connection instance.
|
153
|
+
|
154
|
+
|
155
|
+
## \[1.2.5] - 2020-03-30
|
156
|
+
|
157
|
+
### Fixed
|
158
|
+
|
159
|
+
- Classic API (JSS module)
|
160
|
+
- The Classic API now requires JSS::User objects to be passed back to the API with the `ldap_server` specified by id, name-only won't work.
|
161
|
+
|
162
|
+
- Jamf Pro API (Jamf module)
|
163
|
+
- Fixes for various JamfPro API (Jamf module) methods that accept a passed-in Jamf::Connection instance.
|
164
|
+
|
165
|
+
## \[1.2.4] - 2020-03-16
|
166
|
+
|
167
|
+
### Added
|
168
|
+
|
169
|
+
- **'Beta' Jamf Pro API support in ruby-jss!**
|
170
|
+
|
171
|
+
The Jamf Pro API, formerly known as the 'Universal' API, aims to be a far more robust, modern, and standardized way to programmatically access a Jamf Pro server. While its been in development for a while, it is finally starting to settle in to some standards, to the point that its worth releasing some early ruby-jss code to access it.
|
172
|
+
|
173
|
+
Because the JP-API is so fundamentally different from the Classic API, it's being implemented as a totally separate ruby module 'Jamf', and many of the underlying standards of ruby-jss's JSS module are being re-thought and modernized, much like the JP-API itself. Classic API access using the JSS module is unchanged, and will continue to get fixes and other updates as needed. However many things in the Jamf module will behave differently from the JSS module, at least in detail if not concept.
|
174
|
+
|
175
|
+
For requirements and details of using the Jamf module to access the Jamf Pro API, see [lib/jamf/README-JP-API.md](lib/jamf/README-JP-API.md).
|
176
|
+
|
177
|
+
**IMPORTANT:** As with the JP-API, The Jamf module is an early work-in-progress, and things might change drastically at any point. Please mention 'ruby-jss' in MacAdmins Slack channels #jamf-api or #ruby, or email ruby-jss@pixar.com, or open an issue on github if you have questions or want to contribute.
|
178
|
+
|
179
|
+
### Changed
|
180
|
+
|
181
|
+
- The `last_mdm_contact` class and instance method from the MDM mixin module (as used in Computer and MobileDevice classes) now returns the time of the most recent _completed_ or _failed_ mdm command. This is more accurate than just the completed commands, since a failed command still implies contact between the client and Jamf Pro.
|
182
|
+
|
183
|
+
- JSS::MobileDevice instances now have three predicate methods: `tv?` (aliased as `apple_tv?`), `ipad?` and `iphone?`
|
184
|
+
|
7
185
|
## \[1.2.3] - 2019-10-31
|
8
186
|
### Added
|
9
187
|
- the ManagementHistory mixin module used by the Computer and MobileDevice classes, now has a `last_mdm_contact` class and instance method, which returns a Time object for the timestamp of the most recent completed MDM command. This is useful for MobileDevices, which don't have anything like the `last_checkin` value for comptuers, indicating real communication between the device and Jamf Pro.
|
@@ -11,7 +189,8 @@ Note that the `last_inventory_update` value does NOT indicate such communication
|
|
11
189
|
|
12
190
|
- All APIObject Subclasses (Policy, Computer, MobileDevice, ComputerGroup, etc..) now have `get_raw`, `post_raw` & `put_raw` class methods, which are simpler wrappers for APIConnection#get_rsrc, #post_rsrc, and #put_rsrc.
|
13
191
|
- `get_raw` takes an object's id, and returns the 'raw' JSON (parsed into a ruby Hash with symbolized keys) or a REXML::Document (from which you'll probably want to use the `root` element). If you pass `as_string: true` you'll get the un-parsed JSON or XML string directly from the API
|
14
|
-
This can be useful when you need to retrieve the full object, to get some data not available in the summary-list, but instantiating the full ruby class is too slow
|
192
|
+
This can be useful when you need to retrieve the full object, to get some data not available in the summary-list, but instantiating the full ruby class is too slow
|
193
|
+
|
15
194
|
- `post_raw` & `put_raw` can send raw XML to the API without instantiating objects. In some cases, where you're making simple changes to simple XML, this can be faster than fetching a full instance and the re-saving it.
|
16
195
|
WARNING You must create or acquire the XML to be sent, and no validation will be performed on it. It must be a String of XML, or something that returns such a string with #to_s, such as a REXML::Document, or a REXML::Element.
|
17
196
|
|
data/README.md
CHANGED
@@ -45,6 +45,8 @@ Hopefully others will find it useful, and add more to it as well.
|
|
45
45
|
|
46
46
|
[Full technical documentation can be found here.](http://www.rubydoc.info/gems/ruby-jss/)
|
47
47
|
|
48
|
+
NOTE: ruby-jss 1.2.4 will introduce beta-level support for the Jamf Pro API in a ruby module called 'Jamf', See README-JP-API.md in /lib/jamf, or in the 'Files' section of the YARD docs file for details.
|
49
|
+
|
48
50
|
## SYNOPSIS
|
49
51
|
|
50
52
|
Here are some simple examples of using ruby-jss
|
@@ -346,7 +348,7 @@ and then any calls to JSS.api.connect will assume that server and username, and
|
|
346
348
|
|
347
349
|
The config files don't store passwords and the {JSS::Configuration} instance doesn't work with them. You'll have to use your own methods for acquiring the password for the JSS.api.connect call.
|
348
350
|
|
349
|
-
The {JSS::
|
351
|
+
The {JSS::APIConnection.connect} method also accepts the symbols :stdin# and :prompt as values for the :pw argument, which will cause it to read the password from a line of stdin, or prompt for it in the shell.
|
350
352
|
|
351
353
|
If you must store a password in a file, or retrieve it from the network, make sure it's stored securely, and that the JSS user has limited permissions.
|
352
354
|
|
@@ -417,6 +419,6 @@ There's a [wiki on the github page](https://github.com/PixarAnimationStudios/rub
|
|
417
419
|
|
418
420
|
## LICENSE
|
419
421
|
|
420
|
-
Copyright
|
422
|
+
Copyright 2020 Pixar
|
421
423
|
|
422
424
|
Licensed under the Apache License, Version 2.0 (the "Apache License") with modifications. See LICENSE.txt for details
|
data/bin/cgrouper
CHANGED
data/bin/jamfHelperBackgrounder
CHANGED
data/bin/netseg-update
CHANGED
data/data/ruby-jss.conf.example
CHANGED
data/lib/jamf.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")
|
@@ -168,6 +168,7 @@ module Jamf
|
|
168
168
|
autoload :MobileDevicePrestage, 'jamf/api/resources/collection_resources/mobile_device_prestage'
|
169
169
|
autoload :Site, 'jamf/api/resources/collection_resources/site'
|
170
170
|
autoload :Script, 'jamf/api/resources/collection_resources/script'
|
171
|
+
autoload :TimeZone, 'jamf/api/resources/collection_resources/time_zone'
|
171
172
|
|
172
173
|
# other classes used as attributes inside the resource classes
|
173
174
|
autoload :IPAddress, 'jamf/api/attribute_classes/ip_address'
|
@@ -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")
|
@@ -100,15 +100,27 @@ module Jamf
|
|
100
100
|
def self.all(refresh = false, cnx: Jamf.cnx, instantiate: false)
|
101
101
|
validate_not_abstract
|
102
102
|
cnx.collection_cache[self] = nil if refresh
|
103
|
-
|
103
|
+
if cnx.collection_cache[self]
|
104
|
+
return cnx.collection_cache[self] unless instantiate
|
104
105
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
106
|
+
return cnx.collection_cache[self].map { |m| new m }
|
107
|
+
end
|
108
|
+
|
109
|
+
# TODO: make sure all collection resources use this format
|
110
|
+
# for paging. Also -ask Jamf about a url that returns
|
111
|
+
# ALL objects in one query, regardless of number.
|
112
|
+
page = 0
|
113
|
+
raw = cnx.get "#{rsrc_path}?page=#{page}&size=1000000&sort=id%3Aasc"
|
114
|
+
results = raw[:results]
|
115
|
+
|
116
|
+
until results.size >= raw[:totalCount]
|
117
|
+
page += 1
|
118
|
+
raw = cnx.get "#{rsrc_path}?page=#{page}&size=1000000&sort=id%3Aasc"
|
119
|
+
results += raw[:results]
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
cnx.collection_cache[self] = results
|
112
124
|
|
113
125
|
return cnx.collection_cache[self] unless instantiate
|
114
126
|
|
@@ -135,9 +147,10 @@ module Jamf
|
|
135
147
|
# identifier and values are any other attribute.
|
136
148
|
#
|
137
149
|
# @param ident [Symbol] An identifier of this Class, used as the key
|
138
|
-
# for the mapping Hash.
|
150
|
+
# for the mapping Hash. Aliases are acceptable, e.g. :sn for :serialNumber
|
139
151
|
#
|
140
|
-
# @param to [Symbol] The attribute to which the ident will be mapped
|
152
|
+
# @param to [Symbol] The attribute to which the ident will be mapped.
|
153
|
+
# Aliases are acceptable, e.g. :name for :displayName
|
141
154
|
#
|
142
155
|
# @param refresh (see .all)
|
143
156
|
#
|
@@ -146,11 +159,15 @@ module Jamf
|
|
146
159
|
# @return [Hash {Symbol: Object}] A Hash of identifier mapped to attribute
|
147
160
|
#
|
148
161
|
def self.map_all(ident, to:, cnx: Jamf.cnx, refresh: false)
|
162
|
+
real_ident = attr_key_for_alias ident
|
149
163
|
raise Jamf::InvalidDataError, "No identifier #{ident} for class #{self}" unless
|
150
|
-
identifiers.include?
|
164
|
+
identifiers.include? real_ident
|
151
165
|
|
152
|
-
|
166
|
+
real_to = attr_key_for_alias to
|
167
|
+
raise Jamf::NoSuchItemError, "No attribute #{to} for class #{self}" unless self::OBJECT_MODEL.key? real_to
|
153
168
|
|
169
|
+
ident = real_ident
|
170
|
+
to = real_to
|
154
171
|
list = all refresh, cnx: cnx
|
155
172
|
to_class = self::OBJECT_MODEL[to][:class]
|
156
173
|
mapped = list.map do |i|
|
@@ -163,13 +180,15 @@ module Jamf
|
|
163
180
|
end
|
164
181
|
# rubocop:enable Naming/UncommunicativeMethodParamName
|
165
182
|
|
166
|
-
# Given any identfier value for this collection, return the
|
167
|
-
#
|
183
|
+
# Given any identfier value for this collection, return the id of the
|
184
|
+
# object that has such an identifier.
|
168
185
|
#
|
169
|
-
#
|
170
|
-
# then you can specify the identifier, for a faster search:
|
186
|
+
# Return nil if there's no match for the given value.
|
171
187
|
#
|
172
|
-
#
|
188
|
+
# If you know the value is a certain identifier, e.g. a serialNumber,
|
189
|
+
# then you can specify the identifier for a faster search:
|
190
|
+
#
|
191
|
+
# valid_id serialNumber: 'AB12DE34' # => Int or nil
|
173
192
|
#
|
174
193
|
# If you don't know wich identifier you have, just pass the value and
|
175
194
|
# all identifiers are searched
|
@@ -188,7 +207,7 @@ module Jamf
|
|
188
207
|
# @param refresh[Boolean] Reload the list data from the API
|
189
208
|
#
|
190
209
|
# @param ident: [Symbol] Restrict the search to this identifier.
|
191
|
-
# E.g. if :
|
210
|
+
# E.g. if :serialNumber, then the value must be
|
192
211
|
# a known serial number, it is not checked against other identifiers
|
193
212
|
#
|
194
213
|
# @param cnx: (see .all)
|
@@ -209,7 +228,7 @@ module Jamf
|
|
209
228
|
val_is_str = value.is_a? String
|
210
229
|
|
211
230
|
idents.each do |ident|
|
212
|
-
match = all(cnx: cnx).select do |m|
|
231
|
+
match = all(refresh, cnx: cnx).select do |m|
|
213
232
|
val_is_str ? m[ident].to_s.casecmp?(value) : m[ident] == value
|
214
233
|
end.first
|
215
234
|
return match[:id] if match
|
@@ -230,13 +249,20 @@ module Jamf
|
|
230
249
|
end
|
231
250
|
|
232
251
|
# Make a new thing to be added to the API
|
233
|
-
def self.create(params
|
234
|
-
raise Jamf::UnsupportedError, "#{self}'s are not currently creatable via the API" unless self.creatable?
|
235
|
-
|
252
|
+
def self.create(**params)
|
236
253
|
validate_not_abstract
|
254
|
+
raise Jamf::UnsupportedError, "#{self}'s are not currently creatable via the API" unless creatable?
|
255
|
+
|
256
|
+
cnx = params.delete :cnx
|
257
|
+
cnx ||= Jamf.cnx
|
258
|
+
|
237
259
|
params.delete :id # no such animal when .creating
|
238
260
|
|
239
|
-
|
261
|
+
params.keys.each do |param|
|
262
|
+
raise ArgumentError, "Unknown parameter: #{param}" unless self::OBJECT_MODEL.key? param
|
263
|
+
|
264
|
+
params[param] = validate_attr param, params[param], cnx: cnx
|
265
|
+
end
|
240
266
|
|
241
267
|
params[:creating_from_create] = true
|
242
268
|
new params, cnx: cnx
|
@@ -266,16 +292,17 @@ module Jamf
|
|
266
292
|
#
|
267
293
|
def self.fetch(ident_value = nil, cnx: Jamf.cnx, **ident_hash)
|
268
294
|
validate_not_abstract
|
295
|
+
|
269
296
|
id =
|
270
297
|
if ident_value == :random
|
271
298
|
all_ids.sample
|
272
299
|
elsif ident_value
|
273
|
-
valid_id ident_value
|
300
|
+
valid_id ident_value, cnx: cnx
|
274
301
|
elsif ident_hash.empty?
|
275
302
|
nil
|
276
303
|
else
|
277
304
|
ident, lookup_value = ident_hash.first
|
278
|
-
valid_id ident => lookup_value
|
305
|
+
valid_id ident => lookup_value, cnx: cnx
|
279
306
|
end
|
280
307
|
|
281
308
|
raise Jamf::NoSuchItemError, "No matching #{self}" unless id
|
@@ -351,17 +378,6 @@ module Jamf
|
|
351
378
|
end # create_list_methods
|
352
379
|
private_class_method :create_list_methods
|
353
380
|
|
354
|
-
# validate that our .create data is OK
|
355
|
-
#
|
356
|
-
def self.validate_create_params(params, cnx)
|
357
|
-
params.keys.each do |param|
|
358
|
-
raise ArgumentError, "Unknown parameter: #{param}" unless self::OBJECT_MODEL.key? param
|
359
|
-
|
360
|
-
params[param] = validate_attr param, params[param], cnx: cnx
|
361
|
-
end
|
362
|
-
end
|
363
|
-
private_class_method :validate_create_params
|
364
|
-
|
365
381
|
# Given an indentier attr. key, and a value,
|
366
382
|
# return the id where that ident has that value, or nil
|
367
383
|
#
|
@@ -375,7 +391,7 @@ module Jamf
|
|
375
391
|
ident_map = map_all(ident, to: :id, cnx: cnx, refresh: refresh)
|
376
392
|
|
377
393
|
# case-insensitivity for string values
|
378
|
-
value = ident_map.keys.
|
394
|
+
value = ident_map.keys.j_ci_fetch(value) if value.is_a? String
|
379
395
|
|
380
396
|
ident_map[value]
|
381
397
|
end
|