ruby-jss 1.2.4a4 → 1.3.3

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.

Files changed (248) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +185 -1
  3. data/README.md +3 -1
  4. data/bin/cgrouper +1 -1
  5. data/bin/jamfHelperBackgrounder +1 -1
  6. data/bin/netseg-update +1 -1
  7. data/data/ruby-jss.conf.example +1 -1
  8. data/lib/jamf.rb +1 -1
  9. data/lib/jamf/api/abstract_classes/advanced_search.rb +1 -1
  10. data/lib/jamf/api/abstract_classes/collection_resource.rb +31 -26
  11. data/lib/jamf/api/abstract_classes/generic_reference.rb +1 -1
  12. data/lib/jamf/api/abstract_classes/json_object.rb +15 -5
  13. data/lib/jamf/api/abstract_classes/prestage.rb +2 -2
  14. data/lib/jamf/api/abstract_classes/prestage_skip_setup_items.rb +1 -1
  15. data/lib/jamf/api/abstract_classes/resource.rb +1 -1
  16. data/lib/jamf/api/abstract_classes/singleton_resource.rb +1 -1
  17. data/lib/jamf/api/attribute_classes/ip_address.rb +1 -1
  18. data/lib/jamf/api/attribute_classes/timestamp.rb +1 -1
  19. data/lib/jamf/api/connection.rb +106 -60
  20. data/lib/jamf/api/connection/api_error.rb +1 -1
  21. data/lib/jamf/api/connection/api_error_styleguide.rb +1 -1
  22. data/lib/jamf/api/connection/token.rb +80 -13
  23. data/lib/jamf/api/json_objects/account_prefs.rb +1 -1
  24. data/lib/jamf/api/json_objects/android_details.rb +1 -1
  25. data/lib/jamf/api/json_objects/appletv_details.rb +1 -1
  26. data/lib/jamf/api/json_objects/attachment.rb +1 -1
  27. data/lib/jamf/api/json_objects/cellular_network.rb +1 -1
  28. data/lib/jamf/api/json_objects/change_log_entry.rb +1 -1
  29. data/lib/jamf/api/json_objects/computer_prestage_skip_setup_items.rb +1 -1
  30. data/lib/jamf/api/json_objects/country.rb +1 -1
  31. data/lib/jamf/api/json_objects/criterion.rb +1 -1
  32. data/lib/jamf/api/json_objects/device_enrollment_device.rb +1 -1
  33. data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +1 -1
  34. data/lib/jamf/api/json_objects/extension_attribute_value.rb +1 -1
  35. data/lib/jamf/api/json_objects/installed_application.rb +1 -1
  36. data/lib/jamf/api/json_objects/installed_certificate.rb +1 -1
  37. data/lib/jamf/api/json_objects/installed_configuration_profile.rb +1 -1
  38. data/lib/jamf/api/json_objects/installed_ebook.rb +1 -1
  39. data/lib/jamf/api/json_objects/installed_provisioning_profile.rb +1 -1
  40. data/lib/jamf/api/json_objects/inventory_preload_extension_attribute.rb +1 -1
  41. data/lib/jamf/api/json_objects/ios_details.rb +1 -1
  42. data/lib/jamf/api/json_objects/location.rb +1 -1
  43. data/lib/jamf/api/json_objects/md_prestage_name.rb +1 -1
  44. data/lib/jamf/api/json_objects/md_prestage_names.rb +1 -1
  45. data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +1 -1
  46. data/lib/jamf/api/json_objects/mobile_device_details.rb +1 -1
  47. data/lib/jamf/api/json_objects/mobile_device_security.rb +1 -1
  48. data/lib/jamf/api/json_objects/prestage_assignment.rb +1 -1
  49. data/lib/jamf/api/json_objects/prestage_location.rb +1 -1
  50. data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +1 -1
  51. data/lib/jamf/api/json_objects/prestage_scope.rb +1 -1
  52. data/lib/jamf/api/json_objects/prestage_sync_status.rb +1 -1
  53. data/lib/jamf/api/json_objects/purchasing_data.rb +1 -1
  54. data/lib/jamf/api/mixins/abstract.rb +1 -1
  55. data/lib/jamf/api/mixins/bulk_deletable.rb +1 -1
  56. data/lib/jamf/api/mixins/change_log.rb +1 -1
  57. data/lib/jamf/api/mixins/extendable.rb +1 -1
  58. data/lib/jamf/api/mixins/immutable.rb +1 -1
  59. data/lib/jamf/api/mixins/locatable.rb +1 -1
  60. data/lib/jamf/api/mixins/lockable.rb +1 -1
  61. data/lib/jamf/api/mixins/referable.rb +1 -1
  62. data/lib/jamf/api/mixins/searchable.rb +1 -1
  63. data/lib/jamf/api/mixins/uncreatable.rb +1 -1
  64. data/lib/jamf/api/mixins/undeletable.rb +1 -1
  65. data/lib/jamf/api/resources/collection_resources/account.rb +1 -1
  66. data/lib/jamf/api/resources/collection_resources/advanced_mobile_device_search.rb +1 -1
  67. data/lib/jamf/api/resources/collection_resources/advanced_user_search.rb +1 -1
  68. data/lib/jamf/api/resources/collection_resources/building.rb +1 -1
  69. data/lib/jamf/api/resources/collection_resources/category.rb +1 -1
  70. data/lib/jamf/api/resources/collection_resources/computer.rb +1 -1
  71. data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +1 -1
  72. data/lib/jamf/api/resources/collection_resources/department.rb +1 -1
  73. data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +1 -1
  74. data/lib/jamf/api/resources/collection_resources/extension_attribute.rb +1 -1
  75. data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +9 -2
  76. data/lib/jamf/api/resources/collection_resources/mobile_device.rb +1 -1
  77. data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +1 -1
  78. data/lib/jamf/api/resources/collection_resources/script.rb +1 -1
  79. data/lib/jamf/api/resources/collection_resources/site.rb +1 -1
  80. data/lib/jamf/api/resources/collection_resources/time_zone.rb +1 -1
  81. data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +1 -1
  82. data/lib/jamf/api/resources/singleton_resources/authorization.rb +1 -1
  83. data/lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb +1 -1
  84. data/lib/jamf/api/resources/singleton_resources/reenrollment_settings.rb +1 -1
  85. data/lib/jamf/client.rb +1 -1
  86. data/lib/jamf/client/jamf_binary.rb +1 -1
  87. data/lib/jamf/client/jamf_helper.rb +1 -1
  88. data/lib/jamf/client/management_action.rb +1 -1
  89. data/lib/jamf/compatibility.rb +1 -1
  90. data/lib/jamf/composer.rb +1 -1
  91. data/lib/jamf/configuration.rb +8 -10
  92. data/lib/jamf/exceptions.rb +6 -1
  93. data/lib/jamf/ruby_extensions.rb +2 -1
  94. data/lib/jamf/ruby_extensions/array.rb +2 -2
  95. data/lib/jamf/ruby_extensions/array/predicates.rb +1 -1
  96. data/lib/jamf/ruby_extensions/array/utils.rb +4 -4
  97. data/lib/jamf/ruby_extensions/dig.rb +52 -0
  98. data/lib/jamf/ruby_extensions/filetest.rb +1 -1
  99. data/lib/jamf/ruby_extensions/filetest/predicates.rb +1 -1
  100. data/lib/jamf/ruby_extensions/hash.rb +1 -1
  101. data/lib/jamf/ruby_extensions/hash/backports.rb +2 -2
  102. data/lib/jamf/ruby_extensions/ipaddr.rb +1 -1
  103. data/lib/jamf/ruby_extensions/ipaddr/utils.rb +1 -1
  104. data/lib/jamf/ruby_extensions/object.rb +1 -1
  105. data/lib/jamf/ruby_extensions/object/predicates.rb +1 -1
  106. data/lib/jamf/ruby_extensions/pathname.rb +1 -1
  107. data/lib/jamf/ruby_extensions/pathname/predicates.rb +1 -1
  108. data/lib/jamf/ruby_extensions/pathname/utils.rb +1 -1
  109. data/lib/jamf/ruby_extensions/string.rb +1 -1
  110. data/lib/jamf/ruby_extensions/string/backports.rb +1 -1
  111. data/lib/jamf/ruby_extensions/string/conversions.rb +1 -1
  112. data/lib/jamf/ruby_extensions/string/predicates.rb +14 -4
  113. data/lib/jamf/utility.rb +1 -1
  114. data/lib/jamf/validate.rb +1 -1
  115. data/lib/jamf/version.rb +2 -2
  116. data/lib/jpapi.rb +1 -1
  117. data/lib/jss-api.rb +1 -1
  118. data/lib/jss.rb +5 -2
  119. data/lib/jss/api_connection.rb +3 -30
  120. data/lib/jss/api_object.rb +16 -3
  121. data/lib/jss/api_object/account.rb +1 -1
  122. data/lib/jss/api_object/advanced_search.rb +1 -1
  123. data/lib/jss/api_object/advanced_search/advanced_computer_search.rb +1 -1
  124. data/lib/jss/api_object/advanced_search/advanced_mobile_device_search.rb +1 -1
  125. data/lib/jss/api_object/advanced_search/advanced_user_search.rb +1 -1
  126. data/lib/jss/api_object/building.rb +1 -1
  127. data/lib/jss/api_object/categorizable.rb +1 -1
  128. data/lib/jss/api_object/category.rb +1 -1
  129. data/lib/jss/api_object/computer.rb +12 -6
  130. data/lib/jss/api_object/computer/application_installs.rb +1 -1
  131. data/lib/jss/api_object/computer_invitation.rb +1 -1
  132. data/lib/jss/api_object/configuration_profile.rb +4 -2
  133. data/lib/jss/api_object/configuration_profile/mobile_device_configuration_profile.rb +1 -1
  134. data/lib/jss/api_object/configuration_profile/osx_configuration_profile.rb +1 -1
  135. data/lib/jss/api_object/creatable.rb +1 -1
  136. data/lib/jss/api_object/criteriable.rb +10 -5
  137. data/lib/jss/api_object/criteriable/criteria.rb +26 -10
  138. data/lib/jss/api_object/criteriable/criterion.rb +1 -1
  139. data/lib/jss/api_object/department.rb +1 -1
  140. data/lib/jss/api_object/directory_binding.rb +273 -0
  141. data/lib/jss/api_object/directory_binding_type.rb +90 -0
  142. data/lib/jss/api_object/directory_binding_type/active_directory.rb +502 -0
  143. data/lib/jss/api_object/directory_binding_type/admitmac.rb +525 -0
  144. data/lib/jss/api_object/directory_binding_type/centrify.rb +212 -0
  145. data/lib/jss/api_object/directory_binding_type/open_directory.rb +178 -0
  146. data/lib/jss/api_object/directory_binding_type/powerbroker_identity_services.rb +73 -0
  147. data/lib/jss/api_object/disk_encryption_configurations.rb +114 -0
  148. data/lib/jss/api_object/distribution_point.rb +96 -36
  149. data/lib/jss/api_object/dock_item.rb +137 -0
  150. data/lib/jss/api_object/ebook.rb +1 -1
  151. data/lib/jss/api_object/extendable.rb +67 -28
  152. data/lib/jss/api_object/extension_attribute.rb +1 -1
  153. data/lib/jss/api_object/extension_attribute/computer_extension_attribute.rb +1 -1
  154. data/lib/jss/api_object/extension_attribute/mobile_device_extension_attribute.rb +1 -1
  155. data/lib/jss/api_object/extension_attribute/user_extension_attribute.rb +1 -1
  156. data/lib/jss/api_object/group.rb +1 -1
  157. data/lib/jss/api_object/group/computer_group.rb +1 -1
  158. data/lib/jss/api_object/group/mobile_device_group.rb +1 -1
  159. data/lib/jss/api_object/group/user_group.rb +1 -1
  160. data/lib/jss/api_object/ibeacon.rb +1 -1
  161. data/lib/jss/api_object/ldap_server.rb +1 -1
  162. data/lib/jss/api_object/locatable.rb +1 -1
  163. data/lib/jss/api_object/mac_application.rb +1 -1
  164. data/lib/jss/api_object/management_history.rb +23 -22
  165. data/lib/jss/api_object/management_history/audit_event.rb +1 -1
  166. data/lib/jss/api_object/management_history/casper_imaging_log.rb +1 -1
  167. data/lib/jss/api_object/management_history/casper_remote_log.rb +1 -1
  168. data/lib/jss/api_object/management_history/computer_usage_log.rb +1 -1
  169. data/lib/jss/api_object/management_history/ebook.rb +1 -1
  170. data/lib/jss/api_object/management_history/hashlike.rb +1 -1
  171. data/lib/jss/api_object/management_history/mac_app_store_app.rb +1 -1
  172. data/lib/jss/api_object/management_history/mdm_command.rb +1 -1
  173. data/lib/jss/api_object/management_history/mobile_device_app.rb +1 -1
  174. data/lib/jss/api_object/management_history/policy_log.rb +1 -1
  175. data/lib/jss/api_object/management_history/screen_sharing_log.rb +1 -1
  176. data/lib/jss/api_object/management_history/user_location_change.rb +1 -1
  177. data/lib/jss/api_object/matchable.rb +1 -1
  178. data/lib/jss/api_object/mdm.rb +1 -1
  179. data/lib/jss/api_object/mobile_device.rb +29 -6
  180. data/lib/jss/api_object/mobile_device_application.rb +13 -1
  181. data/lib/jss/api_object/netboot_server.rb +1 -1
  182. data/lib/jss/api_object/network_segment.rb +153 -59
  183. data/lib/jss/api_object/package.rb +106 -41
  184. data/lib/jss/api_object/patch_policy.rb +1 -1
  185. data/lib/jss/api_object/patch_source.rb +1 -1
  186. data/lib/jss/api_object/patch_source/patch_external_source.rb +1 -1
  187. data/lib/jss/api_object/patch_source/patch_internal_source.rb +1 -1
  188. data/lib/jss/api_object/patch_title.rb +1 -1
  189. data/lib/jss/api_object/patch_title/version.rb +1 -1
  190. data/lib/jss/api_object/peripheral.rb +1 -1
  191. data/lib/jss/api_object/peripheral_type.rb +1 -1
  192. data/lib/jss/api_object/policy.rb +380 -5
  193. data/lib/jss/api_object/printer.rb +440 -0
  194. data/lib/jss/api_object/purchasable.rb +1 -1
  195. data/lib/jss/api_object/removable_macaddr.rb +1 -1
  196. data/lib/jss/api_object/restricted_software.rb +1 -1
  197. data/lib/jss/api_object/scopable.rb +1 -1
  198. data/lib/jss/api_object/scopable/scope.rb +257 -37
  199. data/lib/jss/api_object/script.rb +1 -1
  200. data/lib/jss/api_object/self_servable.rb +7 -7
  201. data/lib/jss/api_object/self_servable/icon.rb +1 -1
  202. data/lib/jss/api_object/sitable.rb +6 -2
  203. data/lib/jss/api_object/site.rb +1 -1
  204. data/lib/jss/api_object/software_update_server.rb +1 -1
  205. data/lib/jss/api_object/updatable.rb +1 -1
  206. data/lib/jss/api_object/uploadable.rb +1 -1
  207. data/lib/jss/api_object/user.rb +5 -3
  208. data/lib/jss/api_object/vppable.rb +1 -1
  209. data/lib/jss/api_object/webhook.rb +1 -1
  210. data/lib/jss/client.rb +1 -1
  211. data/lib/jss/client/jamf_binary.rb +1 -1
  212. data/lib/jss/client/jamf_helper.rb +1 -1
  213. data/lib/jss/client/management_action.rb +1 -1
  214. data/lib/jss/compatibility.rb +1 -1
  215. data/lib/jss/composer.rb +2 -2
  216. data/lib/jss/configuration.rb +1 -1
  217. data/lib/jss/db_connection.rb +1 -1
  218. data/lib/jss/exceptions.rb +1 -1
  219. data/lib/jss/ruby_extensions.rb +1 -1
  220. data/lib/jss/ruby_extensions/array.rb +1 -1
  221. data/lib/jss/ruby_extensions/filetest.rb +1 -1
  222. data/lib/jss/ruby_extensions/hash.rb +1 -1
  223. data/lib/jss/ruby_extensions/ipaddr.rb +1 -1
  224. data/lib/jss/ruby_extensions/pathname.rb +1 -1
  225. data/lib/jss/ruby_extensions/string.rb +1 -1
  226. data/lib/jss/ruby_extensions/string/backports.rb +1 -1
  227. data/lib/jss/ruby_extensions/string/conversions.rb +1 -1
  228. data/lib/jss/ruby_extensions/string/predicates.rb +14 -4
  229. data/lib/jss/ruby_extensions/time.rb +1 -1
  230. data/lib/jss/server.rb +1 -1
  231. data/lib/jss/utility.rb +9 -23
  232. data/lib/jss/validate.rb +1 -1
  233. data/lib/jss/version.rb +2 -2
  234. data/lib/jss/xml_workaround.rb +1 -1
  235. data/lib/ruby-jss.rb +1 -1
  236. data/test/bin/runtests +1 -1
  237. data/test/lib/testhelper.rb +1 -1
  238. data/test/lib/testhelper/auth.rb +1 -1
  239. data/test/lib/testhelper/patch_mgmt.rb +1 -1
  240. data/test/specs/api_connection_spec.rb +1 -1
  241. data/test/specs/patch01_source_spec.rb +1 -1
  242. data/test/specs/patch02_internal_source_spec.rb +1 -1
  243. data/test/specs/patch03_external_source_spec.rb +1 -1
  244. data/test/specs/patch04_titles_spec.rb +1 -1
  245. data/test/specs/patch05_policies_spec.rb +1 -1
  246. data/test/specs/patch06_cleanup_spec.rb +1 -1
  247. data/test/specs/policy_spec.rb +1 -1
  248. metadata +15 -4
@@ -0,0 +1,525 @@
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
+
30
+ module DirectoryBindingType
31
+
32
+ # Module Variables
33
+ #####################################
34
+
35
+ # Module Methods
36
+ #####################################
37
+
38
+ # Classes
39
+ #####################################
40
+
41
+ # Class for the specific ADmitMac DirectoryBinding type stored within the JSS
42
+ #
43
+ # @author Tyler Morgan
44
+ #
45
+ # @note "Map Home Directory To Attribute" is currently only available in the Jamf Pro UI not through the API.
46
+ #
47
+ # Attributes
48
+ # @!attribute [rw] require_confirmation
49
+ # @!attribute [rw] local_home
50
+ # @!attribute [rw] mount_style
51
+ # @!attribute [rw] default_shell
52
+ # @!attribute [rw] mount_network_home
53
+ # @!attribute [rw] place_home_folders
54
+ # @!attribute [rw] uid
55
+ # @!attribute [rw] user_gid
56
+ # @!attribute [rw] gid
57
+ # @!attribute [rw] admin_group
58
+ # @!attribute [rw] cached_credentials
59
+ # @!attribute [rw] add_user_to_local
60
+ # @!attribute [rw] users_ou
61
+ # @!attribute [rw] groups_ou
62
+ # @!attribute [rw] printers_ou
63
+ # @!attribute [rw] shared_folders_ou
64
+ # TODO: Include default values upon creation
65
+
66
+ class ADmitMac < DirectoryBindingType
67
+ # Mix-Ins
68
+ #####################################
69
+
70
+ # Class Methods
71
+ #####################################
72
+
73
+ # Class Constants
74
+ #####################################
75
+
76
+ # Attributes
77
+ #####################################
78
+
79
+ attr_reader :require_confirmation
80
+ attr_reader :local_home
81
+ attr_reader :mount_style
82
+ attr_reader :default_shell
83
+ attr_reader :mount_network_home
84
+ attr_reader :place_home_folders
85
+ attr_reader :uid
86
+ attr_reader :user_gid
87
+ attr_reader :gid
88
+ attr_reader :admin_group
89
+ attr_reader :cached_credentials
90
+ attr_reader :add_user_to_local
91
+ attr_reader :users_ou
92
+ attr_reader :groups_ou
93
+ attr_reader :printers_ou
94
+ attr_reader :shared_folders_ou
95
+
96
+ # Constructor
97
+ #####################################
98
+
99
+ # An initializer for the ADmitMac object.
100
+ #
101
+ # @author Tyler Morgan
102
+ # @see JSS::DirectoryBinding
103
+ # @see JSS::DirectoryBindingType
104
+ #
105
+ # @note Due to a JSS API funk, mount_style is not able to be configured through the API. It is linked to place_home_folders
106
+ #
107
+ # @param [Hash] initialize data
108
+ def initialize(init_data)
109
+
110
+ # Return without processing anything since there is
111
+ # nothing to process.
112
+ return if init_data.nil?
113
+
114
+ # Process the provided information
115
+ @require_confirmation = init_data[:require_confirmation]
116
+ @default_shell = init_data[:default_shell]
117
+ @mount_network_home = init_data[:mount_network_home]
118
+ @place_home_folders = init_data[:place_home_folders]
119
+ @uid = init_data[:uid]
120
+ @user_gid = init_data[:user_gid]
121
+ @gid = init_data[:gid]
122
+ @cached_credentials = init_data[:cached_credentials]
123
+ @add_user_to_local = init_data[:add_user_to_local]
124
+ @users_ou = init_data[:users_ou]
125
+ @groups_ou = init_data[:groups_ou]
126
+ @printers_ou = init_data[:printers_ou]
127
+ @shared_folders_ou = init_data[:shared_folders_ou]
128
+ @mount_style = init_data[:mount_style]
129
+
130
+ if init_data[:local_home].nil? || init_data[:local_home].is_a?(String)
131
+ raise JSS::InvalidDataError, "Local Home must be one of #{HOME_FOLDER_TYPE.values.join(', ')}." unless HOME_FOLDER_TYPE.values.include? init_data[:local_home] || init_data[:local_home].nil?
132
+
133
+ @local_home = init_data[:local_home]
134
+ else
135
+ raise JSS::InvalidDataError, "Local Home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? init_data[:local_home]
136
+ end
137
+
138
+ if init_data[:admin_group].nil?
139
+ # This is needed since we have the ability to add and
140
+ # remove admin groups from this array.
141
+ @admin_group = []
142
+ elsif init_data[:admin_group].is_a? String
143
+ @admin_group = init_data[:admin_group].split(',')
144
+ else
145
+ @admin_group = init_data[:admin_group]
146
+ end
147
+ end
148
+
149
+
150
+
151
+ # Public Instance Methods
152
+ #####################################
153
+
154
+ # Require confirmation before creating a mobile account on the system.
155
+ #
156
+ # @author Tyler Morgan
157
+ #
158
+ # @param newvalue [Bool]
159
+ #
160
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
161
+ #
162
+ # @return [void]
163
+ def require_confirmation=(newvalue)
164
+
165
+ raise JSS::InvalidDataError, "require_confirmation must be true or false." unless newvalue.is_a? Bool
166
+
167
+ @require_confirmation = newvalue
168
+
169
+ self.container&.should_update
170
+ end
171
+
172
+
173
+ # The type of home directory type created upon logging into a system
174
+ #
175
+ # @author Tyler Morgan
176
+ #
177
+ # @param newvalue [Symbol] The key specific to the folder type you want in HOME_FOLDER_TYPE
178
+ # @see JSS::DirectoryBindingType::HOME_FOLDER_TYPE
179
+ #
180
+ # @raise [JSS::InvalidDataError] If the new value is not one of the possible keys in HOME_FOLDER_TYPE
181
+ #
182
+ # @return [void]
183
+ def local_home=(newvalue)
184
+
185
+ raise JSS::InvalidDataError, "local_home must be one of :#{HOME_FOLDER_TYPE.keys.join(',:')}." unless HOME_FOLDER_TYPE.keys.include? newvalue
186
+
187
+ @local_home = HOME_FOLDER_TYPE[newvalue]
188
+
189
+ self.container&.should_update
190
+ end
191
+
192
+ # The default shell assigned first upon logging into a system
193
+ #
194
+ # @author Tyler Morgan
195
+ #
196
+ # @param newvalue [String] The string path of the shell file being set as the default
197
+ #
198
+ # @raise [JSS::InvalidDataError] If the new value is not a String
199
+ #
200
+ # @return [void]
201
+ def default_shell=(newvalue)
202
+
203
+ raise JSS::InvalidDataError, "default_shell must be empty or a string." unless newvalue.is_a?(String)
204
+
205
+ @default_shell = newvalue
206
+
207
+ self.container&.should_update
208
+ end
209
+
210
+
211
+ # Mount network home folder on desktop
212
+ #
213
+ # @author Tyler Morgan
214
+ #
215
+ # @param newvalue [Bool]
216
+ #
217
+ # @raise [JSS::InvalidDataError] If the new value is not a Bool
218
+ #
219
+ # @return [void]
220
+ def mount_network_home=(newvalue)
221
+
222
+ raise JSS::InvalidDataError, "mount_network_home must be true or false." unless newvalue.is_a? Bool
223
+
224
+ @mount_network_home = newvalue
225
+
226
+ self.container&.should_update
227
+ end
228
+
229
+ # Path at which home folders are placed
230
+ #
231
+ # @author Tyler Morgan
232
+ #
233
+ # @param newvalue [String] The string path of the folder which user's directory files and folders will be created
234
+ #
235
+ # @raise [JSS::InvalidDataError] If the new value is not a String
236
+ #
237
+ # @return [void]
238
+ def place_home_folders=(newvalue)
239
+
240
+ raise JSS::InvalidDataError, "place_home_folders must be a string." unless newvalue.is_a? String
241
+
242
+ @place_home_folders = newvalue
243
+
244
+ self.container&.should_update
245
+ end
246
+
247
+ # Jamf has these linked for some reason...
248
+ alias mount_style place_home_folders
249
+
250
+
251
+ # Map specific UID to Attribute
252
+ #
253
+ # @author Tyler Morgan
254
+ #
255
+ # @param newvalue [String] The UID you want to be mapped
256
+ #
257
+ # @raise [JSS::InvalidDataError] If the new value is not a String
258
+ #
259
+ # @return [void]
260
+ def uid=(newvalue)
261
+
262
+ raise JSS::InvalidDataError, "uid must be a string, integer, or nil." unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil?
263
+
264
+ @uid = newvalue
265
+
266
+ self.container&.should_update
267
+ end
268
+
269
+
270
+ # Map specific a User's GID to Attribute
271
+ #
272
+ # @author Tyler Morgan
273
+ #
274
+ # @param newvalue [String] The User's GID you want to be mapped
275
+ #
276
+ # @raise [JSS::InvalidDataError] If the new value is not a String
277
+ #
278
+ # @return [void]
279
+ def user_gid=(newvalue)
280
+
281
+ raise JSS::InvalidDataError, "user_gid must be a string, integer, or nil." unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil?
282
+
283
+ @user_gid = newvalue
284
+
285
+ self.container&.should_update
286
+ end
287
+
288
+
289
+ # Map specific GID to Attribute
290
+ #
291
+ # @author Tyler Morgan
292
+ #
293
+ # @param newvalue [String] The GID you want to be mapped
294
+ #
295
+ # @raise [JSS::InvalidDataError] If the new value is not a String
296
+ #
297
+ # @return [void]
298
+ def gid=(newvalue)
299
+
300
+ raise JSS::InvalidDataError, "gid must be a string, integer, or nil." unless newvalue.is_a?(String) || newvalue.is_a?(Integer) || newvalue.nil?
301
+
302
+ @gid = newvalue
303
+
304
+ self.container&.should_update
305
+ end
306
+
307
+ # Set specific groups to become administrators to a system.
308
+ #
309
+ # @author Tyler Morgan
310
+ #
311
+ # @param newvalue [Array<String>] An array of all the admin group names you want to set.
312
+ # @see add_admin_group
313
+ # @see remove_admin_group
314
+ #
315
+ # @raise [JSS::InvalidDataError] If the new value is not an Array
316
+ #
317
+ # @return [void]
318
+ def admin_group=(newvalue)
319
+
320
+ raise JSS::InvalidDataError, "An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals." unless newvalue.is_a? Array
321
+
322
+ @admin_group = newvalue
323
+
324
+ self.container&.should_update
325
+ end
326
+
327
+
328
+ # The number of times a user can log into the device while not connected to a network
329
+ #
330
+ # @author Tyler Morgan
331
+ #
332
+ # @param newvalue [Integer] The number of times you want a user to login while not connected to a network
333
+ #
334
+ # @raise [JSS::InvalidDataError] If the new value is not an Integer
335
+ #
336
+ # @return [void]
337
+ def cached_credentials=(newvalue)
338
+
339
+ raise JSS::InvalidDataError, "cached_credentials must be an integer." unless newvalue.is_a? Integer
340
+
341
+ @cached_credentials = newvalue
342
+
343
+ self.container&.should_update
344
+ end
345
+
346
+
347
+ # If the user is a member of one of the groups in admin_group, add them
348
+ # to the local administrator group.
349
+ #
350
+ # @author Tyler Morgan
351
+ # @see admin_group
352
+ #
353
+ # @param newvalue [Bool]
354
+ #
355
+ # @raise [JSS::InvalidDataError] If the new value is not a Bool
356
+ #
357
+ # @return [void]
358
+ def add_user_to_local=(newvalue)
359
+
360
+ raise JSS::InvalidDataError, "add_user_to_local must be true or false." unless newvalue.is_a? Bool
361
+
362
+ @add_user_to_local = newvalue
363
+
364
+ self.container&.should_update
365
+ end
366
+
367
+
368
+ # An OU path for specific Users
369
+ #
370
+ # @author Tyler Morgan
371
+ #
372
+ # @param newvalue [String] The OU path for the specific user
373
+ # @note Not sure what this is used for
374
+ #
375
+ # @raise [JSS::InvalidDataError] If the new value is not a String
376
+ #
377
+ # @return [void]
378
+ def users_ou=(newvalue)
379
+
380
+ raise JSS::InvalidDataError, "users_ou must be either a string or nil." unless newvalue.is_a? String || newvalue.nil?
381
+
382
+ @users_ou = newvalue
383
+
384
+ self.container&.should_update
385
+ end
386
+
387
+
388
+ # An OU path for specific User Groups
389
+ #
390
+ # @author Tyler Morgan
391
+ #
392
+ # @param newvalue [String] The OU path for the specific user group
393
+ # @note Not sure what this is used for
394
+ #
395
+ # @raise [JSS::InvalidDataError] If the new value is not a String
396
+ #
397
+ # @return [void]
398
+ def groups_ou=(newvalue)
399
+
400
+ raise JSS::InvalidDataError, "groups_ou must be either a string or nil." unless newvalue.is_a? String || newvalue.nil?
401
+
402
+ @groups_ou = newvalue
403
+
404
+ self.container&.should_update
405
+ end
406
+
407
+
408
+ # An OU path for specific Printers
409
+ #
410
+ # @author Tyler Morgan
411
+ #
412
+ # @param newvalue [String] The OU path for the specific printer
413
+ # @note Not sure what this is used for
414
+ #
415
+ # @raise [JSS::InvalidDataError] If the new value is not a String
416
+ #
417
+ # @return [void]
418
+ def printers_ou=(newvalue)
419
+
420
+ raise JSS::InvalidDataError, "printers_ou must be either a string or nil." unless newvalue.is_a? String || newvalue.nil?
421
+
422
+ @printers_ou = newvalue
423
+
424
+ self.container&.should_update
425
+ end
426
+
427
+
428
+ # An OU path for specific shared folders
429
+ #
430
+ # @author Tyler Morgan
431
+ #
432
+ # @param newvalue [String] The OU path for the specific shared folders
433
+ # @note Not sure what this is used for
434
+ #
435
+ # @raise [JSS::InvalidDataError] If the new value is not a String
436
+ #
437
+ # @return [void]
438
+ def shared_folders_ou=(newvalue)
439
+
440
+ raise JSS::InvalidDataError, "shared_folders_ou must be either a string or nil." unless newvalue.is_a? String || newvalue.nil?
441
+
442
+ @shared_folders_ou = newvalue
443
+
444
+ self.container&.should_update
445
+ end
446
+
447
+
448
+ # An a specific admin group to admin_group
449
+ #
450
+ # @author Tyler Morgan
451
+ #
452
+ # @param value [String] The admin group name you wish to add to the admin group list
453
+ #
454
+ # @raise [JSS::InvalidDataError] If the value provided is not a String
455
+ # @raise [JSS::InvalidDataError] If the group provided is already a member of the admin_group array
456
+ #
457
+ # @return [Array <String>] An array of all the admin groups currently set.
458
+ def add_admin_group(value)
459
+
460
+ raise JSS::InvalidDataError, "Admin group must be a string." unless value.is_a? String
461
+ raise JSS::InvalidDataError, "Admin group \"#{value}\" already is in the list of admin groups." unless !@admin_group.include? value
462
+
463
+ @admin_group << value
464
+
465
+ self.container&.should_update
466
+
467
+ return @admin_group
468
+ end
469
+
470
+
471
+ # Remove a specific admin group to admin_group
472
+ #
473
+ # @author Tyler Morgan
474
+ #
475
+ # @param newvalue [String] The admin group name you wish to remove from the admin group list
476
+ #
477
+ # @raise [JSS::InvalidDataError] If the value provided is not a String
478
+ # @raise [JSS::InvalidDataError] If the group provided is not in the admin_group array
479
+ #
480
+ # @return [Array <String>] An array of all the admin groups currently set.
481
+ def remove_admin_group(value)
482
+
483
+ raise JSS::InvalidDataError, "Admin group being removed must be a string" unless value.is_a? String
484
+ raise JSS::InvalidDataError, "Admin group #{value} is not in the current admin group(s)." unless @admin_group.include? value
485
+
486
+ @admin_group.delete value
487
+
488
+ self.container&.should_update
489
+
490
+ return @admin_group
491
+ end
492
+
493
+
494
+ # Return a REXML Element containing the current state of the DirectoryBindingType
495
+ # object for adding into the XML of the container.
496
+ #
497
+ # @author Tyler Morgan
498
+ #
499
+ # @return [REXML::Element]
500
+ def type_setting_xml
501
+ type_setting = REXML::Element.new "admitmac"
502
+ type_setting.add_element("require_confirmation").text = @require_confirmation
503
+ type_setting.add_element("local_home").text = @local_home
504
+ type_setting.add_element("mount_style").text = @mount_style.downcase
505
+ type_setting.add_element("default_shell").text = @default_shell
506
+ type_setting.add_element("mount_network_home").text = @mount_network_home
507
+ type_setting.add_element("place_home_folders").text = @place_home_folders
508
+ type_setting.add_element("uid").text = @uid
509
+ type_setting.add_element("user_gid").text = @user_gid
510
+ type_setting.add_element("gid").text = @gid
511
+ type_setting.add_element("add_user_to_local").text = @add_user_to_local
512
+ type_setting.add_element("cached_credentials").text = @cached_credentials
513
+ type_setting.add_element("users_ou").text = @users_ou
514
+ type_setting.add_element("groups_ou").text = @groups_ou
515
+ type_setting.add_element("printers_ou").text = @printers_ou
516
+ type_setting.add_element("shared_folders_ou").text = @shared_folders_ou
517
+ type_setting.add_element("admin_group").text = @admin_group.join(',').to_s unless @admin_group.nil?
518
+
519
+ return type_setting
520
+ end
521
+ end
522
+
523
+ end
524
+
525
+ end