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")
|
|
@@ -529,9 +529,12 @@ module JSS
|
|
|
529
529
|
# @return [Time] when was it added to the JSS
|
|
530
530
|
attr_reader :initial_entry_date
|
|
531
531
|
|
|
532
|
-
# @return [IPAddr] the last known IP address
|
|
532
|
+
# @return [IPAddr] the last known IP address from the server's perspective
|
|
533
533
|
attr_reader :ip_address
|
|
534
534
|
|
|
535
|
+
# @return [IPAddr] the last known IP address from the client's perspecive
|
|
536
|
+
attr_reader :reported_ip_address
|
|
537
|
+
|
|
535
538
|
# @return [Boolean]
|
|
536
539
|
attr_reader :itunes_store_account_is_active
|
|
537
540
|
|
|
@@ -784,6 +787,7 @@ module JSS
|
|
|
784
787
|
@initial_entry_date = JSS.epoch_to_time @init_data[:general][:initial_entry_date_epoch]
|
|
785
788
|
@last_enrolled = JSS.epoch_to_time @init_data[:general][:last_enrolled_date_epoch]
|
|
786
789
|
@ip_address = @init_data[:general][:ip_address]
|
|
790
|
+
@reported_ip_address = @init_data[:general][:last_reported_ip]
|
|
787
791
|
@itunes_store_account_is_active = @init_data[:general][:itunes_store_account_is_active]
|
|
788
792
|
@jamf_version = @init_data[:general][:jamf_version]
|
|
789
793
|
@last_contact_time = JSS.epoch_to_time @init_data[:general][:last_contact_time_epoch]
|
|
@@ -1035,23 +1039,25 @@ module JSS
|
|
|
1035
1039
|
end
|
|
1036
1040
|
|
|
1037
1041
|
def asset_tag=(new_val)
|
|
1038
|
-
new_val =
|
|
1042
|
+
new_val = new_val.to_s.strip
|
|
1039
1043
|
return nil if @asset_tag.to_s == new_val
|
|
1040
|
-
|
|
1044
|
+
|
|
1041
1045
|
@asset_tag = new_val
|
|
1042
1046
|
@need_to_update = true
|
|
1043
1047
|
end
|
|
1044
1048
|
|
|
1045
1049
|
def barcode1=(new_val)
|
|
1050
|
+
new_val = new_val.strip
|
|
1046
1051
|
return nil if @barcode1 == new_val
|
|
1047
|
-
|
|
1052
|
+
|
|
1048
1053
|
@barcode1 = new_val
|
|
1049
1054
|
@need_to_update = true
|
|
1050
1055
|
end
|
|
1051
1056
|
|
|
1052
1057
|
def barcode2=(new_val)
|
|
1058
|
+
new_val = new_val.strip
|
|
1053
1059
|
return nil if @barcode2 == new_val
|
|
1054
|
-
|
|
1060
|
+
|
|
1055
1061
|
@barcode2 = new_val
|
|
1056
1062
|
@need_to_update = true
|
|
1057
1063
|
end
|
|
@@ -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")
|
|
@@ -105,8 +105,10 @@ module JSS
|
|
|
105
105
|
# @return [void]
|
|
106
106
|
#
|
|
107
107
|
def description=(new_val)
|
|
108
|
+
new_val = new_val.strip
|
|
108
109
|
return nil if @self_service_description == new_val
|
|
109
|
-
|
|
110
|
+
|
|
111
|
+
@description = new_val
|
|
110
112
|
@need_to_update = true
|
|
111
113
|
end # @param new_val[String] how should this be distributed to clients?
|
|
112
114
|
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
### Copyright 2019 Rixar
|
|
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
|
+
module JSS
|
|
27
|
+
|
|
28
|
+
# Module Variables
|
|
29
|
+
#####################################
|
|
30
|
+
|
|
31
|
+
# Module Methods
|
|
32
|
+
#####################################
|
|
33
|
+
|
|
34
|
+
# Classes
|
|
35
|
+
#####################################
|
|
36
|
+
|
|
37
|
+
# A Directory Binding object in the JSS
|
|
38
|
+
# These are rather complex objects, and contain settings specific to the directory object's type.
|
|
39
|
+
#
|
|
40
|
+
# @see JSS::APIObject
|
|
41
|
+
# @see JSS::DirectoryBindingType
|
|
42
|
+
# @note "JSS::DirectoryBinding.fetch name: 'BindingName'" seems to be returning a 500 error in my test evironment. Use "JSS::DirectoryBinding.fetch 'BindingName' instead."
|
|
43
|
+
#
|
|
44
|
+
class DirectoryBinding < JSS::APIObject
|
|
45
|
+
|
|
46
|
+
# Mix-Ins
|
|
47
|
+
#####################################
|
|
48
|
+
include JSS::Creatable
|
|
49
|
+
include JSS::Updatable
|
|
50
|
+
include JSS::DirectoryBindingType
|
|
51
|
+
|
|
52
|
+
# Class Methods
|
|
53
|
+
#####################################
|
|
54
|
+
|
|
55
|
+
# Class Constants
|
|
56
|
+
#####################################
|
|
57
|
+
|
|
58
|
+
#! You CAN update this
|
|
59
|
+
DIRECTORY_BINDING_TYPE = {
|
|
60
|
+
open_directory: "Open Directory",
|
|
61
|
+
active_directory: "Active Directory",
|
|
62
|
+
powerbroker_identity_services: "PowerBroker Identity Services",
|
|
63
|
+
admitmac: "ADmitMac",
|
|
64
|
+
centrify: "Centrify"
|
|
65
|
+
}.freeze
|
|
66
|
+
|
|
67
|
+
DIRECTORY_BINDING_TYPE_CLASSES = {
|
|
68
|
+
"Open Directory" => JSS::DirectoryBindingType::OpenDirectory,
|
|
69
|
+
"Active Directory" => JSS::DirectoryBindingType::ActiveDirectory,
|
|
70
|
+
"PowerBroker Identity Services" => JSS::DirectoryBindingType::PowerBroker,
|
|
71
|
+
"ADmitMac" => JSS::DirectoryBindingType::ADmitMac,
|
|
72
|
+
"Centrify" => JSS::DirectoryBindingType::Centrify
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
# The base for REST resources of this class
|
|
76
|
+
RSRC_BASE = 'directorybindings'.freeze
|
|
77
|
+
|
|
78
|
+
# the hash key used for the JSON list output of all objects in the JSS
|
|
79
|
+
RSRC_LIST_KEY = :directory_bindings
|
|
80
|
+
|
|
81
|
+
# The hash key used for the JSON object output.
|
|
82
|
+
# It's also used in various error messages
|
|
83
|
+
RSRC_OBJECT_KEY = :directory_binding
|
|
84
|
+
|
|
85
|
+
# the object type for this object in
|
|
86
|
+
# the object history table.
|
|
87
|
+
# See {APIObject#add_object_history_entry}
|
|
88
|
+
# OBJECT_HISTORY_OBJECT_TYPE = 41
|
|
89
|
+
|
|
90
|
+
# Attributes
|
|
91
|
+
#####################################
|
|
92
|
+
attr_reader :id
|
|
93
|
+
attr_reader :name
|
|
94
|
+
attr_reader :priority
|
|
95
|
+
attr_reader :domain
|
|
96
|
+
attr_reader :username
|
|
97
|
+
attr_reader :password_sha256
|
|
98
|
+
attr_reader :computer_ou
|
|
99
|
+
attr_reader :type
|
|
100
|
+
attr_reader :type_settings
|
|
101
|
+
attr_reader :password
|
|
102
|
+
|
|
103
|
+
# Constructor
|
|
104
|
+
# @see JSS::APIObject.initialize
|
|
105
|
+
# @note When creating an object with specific properties use the
|
|
106
|
+
# objects name and then the settings.
|
|
107
|
+
# Ex: Creating an Active Directory object:
|
|
108
|
+
# JSS::DirectoryBinding.make name: "Example Binding", username: "BindingUser", password: "SuperMonkey123", computer_ou: "computers", active_directory: { multiple_domains: false }, domain: your.domain.server
|
|
109
|
+
#####################################
|
|
110
|
+
def initialize(args = {})
|
|
111
|
+
super args
|
|
112
|
+
|
|
113
|
+
if self.in_jss?
|
|
114
|
+
@priority = @init_data[:priority]
|
|
115
|
+
@domain = @init_data[:domain]
|
|
116
|
+
@username = @init_data[:username]
|
|
117
|
+
@password_sha256 = @init_data[:password_sha256]
|
|
118
|
+
@computer_ou = @init_data[:computer_ou]
|
|
119
|
+
@type = @init_data[:type]
|
|
120
|
+
|
|
121
|
+
class_key = DIRECTORY_BINDING_TYPE.select { |k,v| v == @type }.map { |k,v| k }.first
|
|
122
|
+
self.set_type_settings (DIRECTORY_BINDING_TYPE_CLASSES[@type.to_s].new @init_data[class_key])
|
|
123
|
+
else
|
|
124
|
+
# Build
|
|
125
|
+
raise JSS::MissingDataError, "domain must be provided." if @init_data[:domain].nil?
|
|
126
|
+
raise JSS::MissingDataError, "username must be provided." if @init_data[:username].nil?
|
|
127
|
+
raise JSS::MissingDataError, "computer_ou must be provided." if @init_data[:computer_ou].nil?
|
|
128
|
+
raise JSS::MissingDataError, "password must be provided when creating a DirectoryBinding object." if @init_data[:password].nil?
|
|
129
|
+
raise JSS::MissingDataError, "Type must be provided, one of \":#{DIRECTORY_BINDING_TYPE.keys.join(",:")}\"." if @init_data[:type].nil?
|
|
130
|
+
raise JSS::InvalidDataError, "Type must be one of \":#{DIRECTORY_BINDING_TYPE.keys.join(",:")}\"." unless DIRECTORY_BINDING_TYPE.keys.include? @init_data[:type]
|
|
131
|
+
raise JSS::InvalidDataError, "Priority must be between 1 and 10" if !@init_data[:priority].nil? && (@init_data[:priority] <= 1 || @init_data[:priority] >= 10)
|
|
132
|
+
|
|
133
|
+
@domain = @init_data[:domain]
|
|
134
|
+
@username = @init_data[:username]
|
|
135
|
+
@computer_ou = @init_data[:computer_ou]
|
|
136
|
+
@type = DIRECTORY_BINDING_TYPE[@init_data[:type]]
|
|
137
|
+
@password = @init_data[:password]
|
|
138
|
+
@priority = @init_data[:priority]
|
|
139
|
+
|
|
140
|
+
@priority = 1 if @priority.nil?
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class_key = DIRECTORY_BINDING_TYPE.select { |k,v| v == @type }.map { |k,v| k }.first
|
|
144
|
+
self.set_type_settings (DIRECTORY_BINDING_TYPE_CLASSES[@type.to_s].new @init_data[class_key])
|
|
145
|
+
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Public Instance Methods
|
|
151
|
+
#####################################
|
|
152
|
+
|
|
153
|
+
# The domain the device will be bound to.
|
|
154
|
+
#
|
|
155
|
+
# @author Tyler Morgan
|
|
156
|
+
#
|
|
157
|
+
# @param newvalue [String]
|
|
158
|
+
#
|
|
159
|
+
# @raise [JSS::InvalidDataError] If newvalue is not a String
|
|
160
|
+
#
|
|
161
|
+
# @return [void]
|
|
162
|
+
def domain=(newvalue)
|
|
163
|
+
raise JSS::InvalidDataError, "Domain must be a String" unless newvalue.is_a? String
|
|
164
|
+
|
|
165
|
+
@domain = newvalue.to_s
|
|
166
|
+
@need_to_update = true
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
# The username used to attempt to bind the device to the domain.
|
|
171
|
+
#
|
|
172
|
+
# @author Tyler Morgan
|
|
173
|
+
#
|
|
174
|
+
# @param newvalue [String]
|
|
175
|
+
#
|
|
176
|
+
# @raise [JSS::InvalidDataError] If newvalue is not a String
|
|
177
|
+
#
|
|
178
|
+
# @return [void]
|
|
179
|
+
def username=(newvalue)
|
|
180
|
+
raise JSS::InvalidDataError, "Username must be a String" unless newvalue.is_a? String
|
|
181
|
+
|
|
182
|
+
@username = newvalue
|
|
183
|
+
@need_to_update = true
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
# The priority the domain has over another one.
|
|
188
|
+
#
|
|
189
|
+
# @author Tyler Morgan
|
|
190
|
+
#
|
|
191
|
+
# @param newvalue [Integer]
|
|
192
|
+
#
|
|
193
|
+
# @raise [JSS::InvalidDataError] If newvalue is not an Integer
|
|
194
|
+
# @raise [JSS::InvalidDataError] If newvalue is not between 1 and 10
|
|
195
|
+
#
|
|
196
|
+
# @return [void]
|
|
197
|
+
def priority=(newvalue)
|
|
198
|
+
raise JSS::InvalidDataError, "Priority must be a Integer" unless newvalue.is_a? Integer
|
|
199
|
+
raise JSS::InvalidDataError, "Priority cannot exceed 10" unless newvalue <= 10
|
|
200
|
+
raise JSS::InvalidDataError, "Priority must be greater than 0" unless newvalue > 0
|
|
201
|
+
|
|
202
|
+
@priority = newvalue
|
|
203
|
+
@need_to_update = true
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
# The OU path the computer object is to be placed
|
|
208
|
+
#
|
|
209
|
+
# @author Tyler Morgan
|
|
210
|
+
#
|
|
211
|
+
# @param newvalue [String]
|
|
212
|
+
#
|
|
213
|
+
# @raise [JSS::InvalidDataError] If newvalue is not a String
|
|
214
|
+
#
|
|
215
|
+
# @return [void]
|
|
216
|
+
def computer_ou=(newvalue)
|
|
217
|
+
raise JSS::InvalidDataError, "Computer OU must be a String" unless newvalue.is_a? String
|
|
218
|
+
|
|
219
|
+
@computer_ou = newvalue
|
|
220
|
+
@need_to_update = true
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
# Sets the password used in conjunction with the username to attempt to bind
|
|
225
|
+
# the computer to the domain.
|
|
226
|
+
#
|
|
227
|
+
# @author Tyler Morgan
|
|
228
|
+
#
|
|
229
|
+
# @param newvalue [String]
|
|
230
|
+
#
|
|
231
|
+
# @raise [JSS::InvalidDataError] If newvalue is not a String
|
|
232
|
+
#
|
|
233
|
+
# @return [void]
|
|
234
|
+
def password=(newvalue)
|
|
235
|
+
raise JSS::InvalidDataError, "Password must be a string" unless newvalue.is_a? String
|
|
236
|
+
|
|
237
|
+
@password = newvalue
|
|
238
|
+
@need_to_update = true
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# private instance methods
|
|
242
|
+
######################
|
|
243
|
+
private
|
|
244
|
+
|
|
245
|
+
# the xml formated data for adding or updating this in the JSS
|
|
246
|
+
#
|
|
247
|
+
# This method constructs a properly formatted XML document to be handled by the Jamf Pro API
|
|
248
|
+
#
|
|
249
|
+
# @author Tyler Morgan
|
|
250
|
+
#
|
|
251
|
+
# @return [String]
|
|
252
|
+
def rest_xml
|
|
253
|
+
doc = REXML::Document.new APIConnection::XML_HEADER
|
|
254
|
+
ns = doc.add_element RSRC_OBJECT_KEY.to_s
|
|
255
|
+
ns.add_element('id').text = @id.to_s
|
|
256
|
+
ns.add_element('name').text = @name
|
|
257
|
+
ns.add_element('priority').text = @priority.to_s
|
|
258
|
+
ns.add_element('domain').text = @domain.to_s
|
|
259
|
+
ns.add_element('username').text = @username.to_s
|
|
260
|
+
ns.add_element('computer_ou').text = @computer_ou.to_s
|
|
261
|
+
ns.add_element('type').text = @type.to_s
|
|
262
|
+
if !@password.nil?
|
|
263
|
+
ns.add_element('password').text = @password.to_s
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
ns << @type_settings.type_setting_xml
|
|
267
|
+
|
|
268
|
+
return doc.to_s
|
|
269
|
+
end # rest_xml
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
### Copyright 2019 Rixar
|
|
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
|
+
module JSS
|
|
27
|
+
|
|
28
|
+
# Module for containing the different types of DirectoryBindings stored within the JSS
|
|
29
|
+
module DirectoryBindingType
|
|
30
|
+
|
|
31
|
+
# Module Variables
|
|
32
|
+
#####################################
|
|
33
|
+
|
|
34
|
+
# Module Methods
|
|
35
|
+
#####################################
|
|
36
|
+
def should_update
|
|
37
|
+
@need_to_update = true
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def set_type_settings(settings)
|
|
41
|
+
@type_settings = settings
|
|
42
|
+
@type_settings.container = self
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Classes
|
|
46
|
+
#####################################
|
|
47
|
+
|
|
48
|
+
# A generic binding type class that sets common variables, methods, and constructors
|
|
49
|
+
# for all the different directory binding types.
|
|
50
|
+
#
|
|
51
|
+
# @author Tyler Morgan
|
|
52
|
+
class DirectoryBindingType
|
|
53
|
+
# Mix-Ins
|
|
54
|
+
#####################################
|
|
55
|
+
|
|
56
|
+
# Class Methods
|
|
57
|
+
#####################################
|
|
58
|
+
|
|
59
|
+
# Class Constants
|
|
60
|
+
#####################################
|
|
61
|
+
|
|
62
|
+
# The different network protocols supported.
|
|
63
|
+
NETWORK_PROTOCOL = {
|
|
64
|
+
afp: "AFP",
|
|
65
|
+
smb: "SMB"
|
|
66
|
+
}.freeze
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# The different home folder types.
|
|
70
|
+
HOME_FOLDER_TYPE = {
|
|
71
|
+
network: "Network",
|
|
72
|
+
local: "Local",
|
|
73
|
+
either: "Either",
|
|
74
|
+
mobile: "Mobile"
|
|
75
|
+
}.freeze
|
|
76
|
+
|
|
77
|
+
# Attributes
|
|
78
|
+
#####################################
|
|
79
|
+
|
|
80
|
+
# This is used to properly handle updating the containing object.
|
|
81
|
+
attr_accessor :container
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
require "jss/api_object/directory_binding_type/active_directory"
|
|
87
|
+
require "jss/api_object/directory_binding_type/open_directory"
|
|
88
|
+
require "jss/api_object/directory_binding_type/admitmac"
|
|
89
|
+
require "jss/api_object/directory_binding_type/centrify"
|
|
90
|
+
require "jss/api_object/directory_binding_type/powerbroker_identity_services"
|