ruby-jss 1.2.10 → 1.3.2

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.

Potentially problematic release.


This version of ruby-jss might be problematic. Click here for more details.

Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +92 -1
  3. data/lib/jamf/api/abstract_classes/json_object.rb +1 -1
  4. data/lib/jamf/api/abstract_classes/prestage.rb +1 -1
  5. data/lib/jamf/api/connection.rb +7 -3
  6. data/lib/jamf/configuration.rb +7 -9
  7. data/lib/jamf/ruby_extensions.rb +1 -0
  8. data/lib/jamf/ruby_extensions/array.rb +1 -1
  9. data/lib/jamf/ruby_extensions/array/utils.rb +3 -3
  10. data/lib/jamf/ruby_extensions/dig.rb +52 -0
  11. data/lib/jss.rb +2 -0
  12. data/lib/jss/api_connection.rb +2 -29
  13. data/lib/jss/api_object.rb +15 -2
  14. data/lib/jss/api_object/directory_binding.rb +273 -0
  15. data/lib/jss/api_object/directory_binding_type.rb +90 -0
  16. data/lib/jss/api_object/directory_binding_type/active_directory.rb +502 -0
  17. data/lib/jss/api_object/directory_binding_type/admitmac.rb +525 -0
  18. data/lib/jss/api_object/directory_binding_type/centrify.rb +212 -0
  19. data/lib/jss/api_object/directory_binding_type/open_directory.rb +178 -0
  20. data/lib/jss/api_object/directory_binding_type/powerbroker_identity_services.rb +73 -0
  21. data/lib/jss/api_object/disk_encryption_configurations.rb +114 -0
  22. data/lib/jss/api_object/distribution_point.rb +95 -35
  23. data/lib/jss/api_object/dock_item.rb +137 -0
  24. data/lib/jss/api_object/mobile_device_application.rb +12 -0
  25. data/lib/jss/api_object/network_segment.rb +152 -58
  26. data/lib/jss/api_object/package.rb +106 -41
  27. data/lib/jss/api_object/policy.rb +379 -4
  28. data/lib/jss/api_object/printer.rb +440 -0
  29. data/lib/jss/api_object/scopable/scope.rb +24 -24
  30. data/lib/jss/composer.rb +1 -1
  31. data/lib/jss/utility.rb +8 -22
  32. data/lib/jss/version.rb +1 -1
  33. metadata +13 -2
@@ -0,0 +1,212 @@
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
+ # Attributes
46
+ # @!attribute [rw] workstation_mode
47
+ # @!attribute [rw] overwrite_existing
48
+ # @!attribute [rw] update_PAM
49
+ # @!attribute [rw] zone
50
+ # @!attribute [rw] preferred_domain_server
51
+ class Centrify < DirectoryBindingType
52
+ # Mix-Ins
53
+ #####################################
54
+
55
+ # Class Methods
56
+ #####################################
57
+
58
+ # Class Constants
59
+ #####################################
60
+
61
+ # Attributes
62
+ #####################################
63
+ attr_reader :workstation_mode
64
+ attr_reader :overwrite_existing
65
+ attr_reader :update_PAM
66
+ attr_reader :zone
67
+ attr_reader :preferred_domain_server
68
+
69
+ # Constructor
70
+ #####################################
71
+
72
+ # An initializer for the Centrify object.
73
+ #
74
+ # @author Tyler Morgan
75
+ # @see JSS::DirectoryBinding
76
+ # @see JSS::DirectoryBindingType
77
+ #
78
+ # @param [Hash] initialize data
79
+ def initialize(init_data)
80
+
81
+ # Return without processing anything since there is
82
+ # nothing to process.
83
+ return if init_data.nil?
84
+
85
+ # Process the provided information
86
+ @workstation_mode = init_data[:workstation_mode]
87
+ @overwrite_existing = init_data[:overwrite_existing]
88
+ @update_PAM = init_data[:update_PAM]
89
+ @zone = init_data[:zone]
90
+ @preferred_domain_server = init_data[:preferred_domain_server]
91
+ end
92
+
93
+
94
+ # Public Instance Methods
95
+ #####################################
96
+
97
+
98
+ # Sets the Centrify Mode to Workstation mode
99
+ #
100
+ # @author Tyler Morgan
101
+ #
102
+ # @param newvalue [Bool]
103
+ #
104
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
105
+ #
106
+ # @return [void]
107
+ def workstation_mode=(newvalue)
108
+
109
+ raise JSS::InvalidDataError, "workstation_mode must be true or false." unless newvalue.is_a? Bool
110
+
111
+ @workstation_mode = newvalue
112
+
113
+ self.container&.should_update
114
+ end
115
+
116
+
117
+ # Want to overwrite existing joined computer in the directory
118
+ #
119
+ # @author Tyler Morgan
120
+ #
121
+ # @param newvalue [Bool]
122
+ #
123
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
124
+ #
125
+ # @return [void]
126
+ def overwrite_existing=(newvalue)
127
+
128
+ raise JSS::InvalidDataError, "overwrite_existing must be true or false." unless newvalue.is_a? Bool
129
+
130
+ @overwrite_existing = newvalue
131
+
132
+ self.container&.should_update
133
+ end
134
+
135
+
136
+ # Update the PAM module and overwrite DirectoryService configuration
137
+ #
138
+ # @author Tyler Morgan
139
+ #
140
+ # @param newvalue [Bool]
141
+ #
142
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
143
+ #
144
+ # @return [void]
145
+ def update_PAM=(newvalue)
146
+
147
+ raise JSS::InvalidDataError, "update_PAM must be true or false." unless newvalue.is_a? Bool
148
+
149
+ @update_PAM = newvalue
150
+
151
+ self.container&.should_update
152
+ end
153
+
154
+
155
+ # The zone the computer is to be joined to
156
+ #
157
+ # @author Tyler Morgan
158
+ #
159
+ # @param newvalue [String] the new zone the computer is to be joined to
160
+ #
161
+ # @raise [JSS::InvalidDataError] If the new value is not a string.
162
+ #
163
+ # @return [void]
164
+ def zone=(newvalue)
165
+
166
+ raise JSS::InvalidDataError, "zone must be a string." unless newvalue.is_a? String
167
+
168
+ @zone = newvalue
169
+
170
+ self.container&.should_update
171
+ end
172
+
173
+
174
+ # The specific domain server that should be prioritized
175
+ #
176
+ # @author Tyler Morgan
177
+ #
178
+ # @param newvalue [String] The domain server that would be prioritized.
179
+ #
180
+ # @raise [JSS::InvalidDataError] If the new value is not a string.
181
+ #
182
+ # @return [void]
183
+ def preferred_domain_server=(newvalue)
184
+
185
+ raise JSS::InvalidDataError, "preferred_domain_server must be a string." unless newvalue.is_a? String
186
+
187
+ @preferred_domain_server = newvalue
188
+
189
+ self.container&.should_update
190
+ end
191
+
192
+
193
+ # Return a REXML Element containing the current state of the DirectoryBindingType
194
+ # object for adding into the XML of the container.
195
+ #
196
+ # @author Tyler Morgan
197
+ #
198
+ # @return [REXML::Element]
199
+ def type_setting_xml
200
+ type_setting = REXML::Element.new "centrify"
201
+ type_setting.add_element("workstation_mode").text = @workstation_mode
202
+ type_setting.add_element("overwrite_existing").text = @overwrite_existing
203
+ type_setting.add_element("update_PAM").text = @update_PAM
204
+ type_setting.add_element("zone").text = @zone
205
+ type_setting.add_element("preferred_domain_server").text = @preferred_domain_server
206
+
207
+ return type_setting
208
+ end
209
+
210
+ end
211
+ end
212
+ end
@@ -0,0 +1,178 @@
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 OpenDirectory DirectoryBinding type stored within the JSS
42
+ #
43
+ # @author Tyler Morgan
44
+ #
45
+ # Attributes
46
+ # @!attribute [rw] require_confirmation
47
+
48
+ class OpenDirectory < DirectoryBindingType
49
+ # Mix-Ins
50
+ #####################################
51
+
52
+ # Class Methods
53
+ #####################################
54
+
55
+ # Class Constants
56
+ #####################################
57
+
58
+ # Attributes
59
+ #####################################
60
+ attr_reader :encrypt_using_ssl
61
+ attr_reader :perform_secure_bind
62
+ attr_reader :use_for_authentication
63
+ attr_reader :use_for_contacts
64
+
65
+ # Constructor
66
+ #####################################
67
+ def initialize(init_data)
68
+
69
+ # Return without processing anything since there is
70
+ # nothing to process.
71
+ return if init_data.nil?
72
+
73
+ # Process the provided information
74
+ @encrypt_using_ssl = init_data[:encrypt_using_ssl]
75
+ @perform_secure_bind = init_data[:perform_secure_bind]
76
+ @use_for_authentication = init_data[:use_for_authentication]
77
+ @use_for_contacts = init_data[:use_for_contacts]
78
+ end
79
+
80
+
81
+
82
+ # Public Instance Methods
83
+ #####################################
84
+
85
+ # Encrypt the connection using SSL
86
+ #
87
+ # @author Tyler Morgan
88
+ #
89
+ # @param newvalue [Bool]
90
+ #
91
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
92
+ #
93
+ # @return [void]
94
+ def encrypt_using_ssl=(newvalue)
95
+
96
+ raise JSS::InvalidDataError, "encrypt_using_ssl must be true or false." unless newvalue.is_a? Bool
97
+
98
+ @encrypt_using_ssl = newvalue
99
+
100
+ self.container&.should_update
101
+ end
102
+
103
+
104
+ # Attempt to perform a secure bind to the domain server
105
+ #
106
+ # @author Tyler Morgan
107
+ #
108
+ # @param newvalue [Bool]
109
+ #
110
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
111
+ #
112
+ # @return [void]
113
+ def perform_secure_bind=(newvalue)
114
+
115
+ raise JSS::InvalidDataError, "perform_secure_bind must be true or false." unless newvalue.is_a? Bool
116
+
117
+ @perform_secure_bind = newvalue
118
+
119
+ self.container&.should_update
120
+ end
121
+
122
+
123
+ # Use this binding for authentication
124
+ #
125
+ # @author Tyler Morgan
126
+ #
127
+ # @param newvalue [Bool]
128
+ #
129
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
130
+ #
131
+ # @return [void]
132
+ def use_for_authentication=(newvalue)
133
+
134
+ raise JSS::InvalidDataError, "use_for_authentication must be true or false." unless newvalue.is_a? Bool
135
+
136
+ @use_for_authentication = newvalue
137
+
138
+ self.container&.should_update
139
+ end
140
+
141
+
142
+ # Use this binding for contact population
143
+ #
144
+ # @author Tyler Morgan
145
+ #
146
+ # @param newvalue [Bool]
147
+ #
148
+ # @raise [JSS::InvalidDataError] If the new value doesn't match a Bool value
149
+ #
150
+ # @return [void]
151
+ def use_for_contacts=(newvalue)
152
+
153
+ raise JSS::InvalidDataError, "use_for_contacts must be true or false." unless newvalue.is_a? Bool
154
+
155
+ @use_for_contacts = newvalue
156
+
157
+ self.container&.should_update
158
+ end
159
+
160
+
161
+ # Return a REXML Element containing the current state of the DirectoryBindingType
162
+ # object for adding into the XML of the container.
163
+ #
164
+ # @author Tyler Morgan
165
+ #
166
+ # @return [REXML::Element]
167
+ def type_setting_xml
168
+ type_setting = REXML::Element.new "admitmac"
169
+ type_setting.add_element("encrypt_using_ssl").text = @encrypt_using_ssl
170
+ type_setting.add_element("perform_secure_bind").text = @perform_secure_bind
171
+ type_setting.add_element("use_for_authentication").text = @use_for_authentication
172
+ type_setting.add_element("use_for_contacts").text = @use_for_contacts
173
+
174
+ return type_setting
175
+ end
176
+ end
177
+ end
178
+ end
@@ -0,0 +1,73 @@
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 PowerBroker DirectoryBinding type stored within the JSS
42
+ #
43
+ # @author Tyler Morgan
44
+ #
45
+ # Attributes
46
+ class PowerBroker < DirectoryBindingType
47
+ # Mix-Ins
48
+ #####################################
49
+
50
+
51
+ # Class Methods
52
+ #####################################
53
+
54
+
55
+ # Class Constants
56
+ #####################################
57
+
58
+
59
+ # Attributes
60
+ #####################################
61
+
62
+
63
+ # Constructor
64
+ #####################################
65
+ def initialize(init_data)
66
+ end
67
+
68
+
69
+ # Public Instance Methods
70
+ #####################################
71
+ end
72
+ end
73
+ end