ruby-jss 1.3.2 → 1.5.3
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 +122 -0
- data/lib/jamf.rb +18 -16
- data/lib/jamf/api/base_classes/collection_resource.rb +613 -0
- data/lib/jamf/api/{abstract_classes → base_classes}/json_object.rb +109 -101
- data/lib/jamf/api/{abstract_classes → base_classes}/prestage.rb +55 -30
- data/lib/jamf/api/{abstract_classes → base_classes}/resource.rb +10 -6
- data/lib/jamf/api/{abstract_classes → base_classes}/singleton_resource.rb +4 -3
- data/lib/jamf/api/connection.rb +13 -9
- data/lib/jamf/api/connection/api_error.rb +8 -8
- data/lib/jamf/api/connection/token.rb +36 -15
- data/lib/jamf/api/json_objects/device_enrollment_device.rb +14 -7
- data/lib/jamf/api/json_objects/{location.rb → device_enrollment_device_sync_state.rb} +27 -41
- data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +1 -1
- data/lib/jamf/api/json_objects/{attachment.rb → locale.rb} +14 -23
- data/lib/jamf/api/json_objects/md_prestage_name.rb +1 -1
- data/lib/jamf/api/json_objects/md_prestage_names.rb +2 -2
- data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +50 -1
- data/lib/jamf/api/json_objects/prestage_assignment.rb +2 -2
- data/lib/jamf/api/json_objects/prestage_location.rb +3 -3
- data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +7 -7
- data/lib/jamf/api/json_objects/prestage_scope.rb +1 -1
- data/lib/jamf/api/{resources/collection_resources → json_objects}/time_zone.rb +9 -23
- data/lib/jamf/api/mixins/{abstract.rb → base_class.rb} +34 -16
- data/lib/jamf/api/mixins/bulk_deletable.rb +27 -6
- data/lib/jamf/api/mixins/change_log.rb +201 -51
- data/lib/jamf/api/{resources/collection_resources/computer.rb → mixins/filterable.rb} +19 -17
- data/lib/jamf/api/mixins/pageable.rb +208 -0
- data/lib/jamf/api/{json_objects/installed_application.rb → mixins/sortable.rb} +33 -33
- data/lib/jamf/api/resources/collection_resources/building.rb +16 -9
- data/lib/jamf/api/resources/collection_resources/category.rb +5 -4
- data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +12 -5
- data/lib/jamf/api/resources/collection_resources/department.rb +1 -3
- data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +13 -13
- data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +11 -3
- data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +25 -23
- data/lib/jamf/api/resources/collection_resources/script.rb +61 -25
- data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +15 -5
- data/lib/jamf/api/resources/singleton_resources/locales.rb +155 -0
- data/lib/jamf/api/resources/singleton_resources/time_zones.rb +213 -0
- data/lib/jamf/validate.rb +63 -24
- data/lib/jamf/version.rb +1 -1
- data/lib/jss.rb +2 -1
- data/lib/jss/api_connection.rb +113 -406
- data/lib/jss/api_object.rb +10 -20
- data/lib/jss/api_object/advanced_search.rb +27 -26
- data/lib/jss/api_object/app_store_country_codes.rb +298 -0
- data/lib/jss/api_object/categorizable.rb +1 -1
- data/lib/jss/api_object/computer.rb +13 -0
- data/lib/jss/api_object/configuration_profile.rb +60 -4
- data/lib/jss/api_object/directory_binding_type.rb +66 -60
- data/lib/jss/api_object/directory_binding_type/active_directory.rb +71 -34
- data/lib/jss/api_object/directory_binding_type/admitmac.rb +536 -467
- data/lib/jss/api_object/directory_binding_type/centrify.rb +21 -7
- data/lib/jss/api_object/directory_binding_type/open_directory.rb +4 -4
- data/lib/jss/api_object/distribution_point.rb +2 -2
- data/lib/jss/api_object/dock_item.rb +102 -96
- data/lib/jss/api_object/ebook.rb +1 -2
- data/lib/jss/api_object/extendable.rb +1 -1
- data/lib/jss/api_object/extension_attribute.rb +4 -3
- data/lib/jss/api_object/group.rb +33 -2
- data/lib/jss/api_object/mac_application.rb +107 -8
- data/lib/jss/api_object/network_segment.rb +43 -12
- data/lib/jss/api_object/package.rb +1 -1
- data/lib/jss/api_object/patch_source.rb +10 -9
- data/lib/jss/api_object/policy.rb +217 -28
- data/lib/jss/api_object/printer.rb +10 -4
- data/lib/jss/api_object/scopable.rb +10 -15
- data/lib/jss/api_object/scopable/scope.rb +389 -73
- data/lib/jss/api_object/self_servable.rb +17 -9
- data/lib/jss/api_object/uploadable.rb +1 -1
- data/lib/jss/api_object/user.rb +42 -1
- data/lib/jss/api_object/vpp_account.rb +209 -0
- data/lib/jss/api_object/vppable.rb +169 -13
- data/lib/jss/exceptions.rb +3 -0
- data/lib/jss/server.rb +15 -0
- data/lib/jss/utility.rb +142 -37
- data/lib/jss/validate.rb +53 -10
- data/lib/jss/version.rb +1 -1
- metadata +45 -61
- data/lib/jamf/api/abstract_classes/advanced_search.rb +0 -86
- data/lib/jamf/api/abstract_classes/collection_resource.rb +0 -433
- data/lib/jamf/api/abstract_classes/generic_reference.rb +0 -145
- data/lib/jamf/api/abstract_classes/prestage_skip_setup_items.rb +0 -126
- data/lib/jamf/api/json_objects/account_prefs.rb +0 -79
- data/lib/jamf/api/json_objects/android_details.rb +0 -139
- data/lib/jamf/api/json_objects/appletv_details.rb +0 -110
- data/lib/jamf/api/json_objects/cellular_network.rb +0 -151
- data/lib/jamf/api/json_objects/computer_prestage_skip_setup_items.rb +0 -67
- data/lib/jamf/api/json_objects/criterion.rb +0 -152
- data/lib/jamf/api/json_objects/extension_attribute_value.rb +0 -128
- data/lib/jamf/api/json_objects/installed_certificate.rb +0 -53
- data/lib/jamf/api/json_objects/installed_configuration_profile.rb +0 -67
- data/lib/jamf/api/json_objects/installed_ebook.rb +0 -58
- data/lib/jamf/api/json_objects/installed_provisioning_profile.rb +0 -59
- data/lib/jamf/api/json_objects/ios_details.rb +0 -244
- data/lib/jamf/api/json_objects/mobile_device_details.rb +0 -219
- data/lib/jamf/api/json_objects/mobile_device_security.rb +0 -101
- data/lib/jamf/api/json_objects/purchasing_data.rb +0 -125
- data/lib/jamf/api/mixins/locatable.rb +0 -124
- data/lib/jamf/api/mixins/referable.rb +0 -92
- data/lib/jamf/api/resources/collection_resources/account.rb +0 -163
- data/lib/jamf/api/resources/collection_resources/advanced_mobile_device_search.rb +0 -52
- data/lib/jamf/api/resources/collection_resources/advanced_user_search.rb +0 -52
- data/lib/jamf/api/resources/collection_resources/extension_attribute.rb +0 -45
- data/lib/jamf/api/resources/collection_resources/mobile_device.rb +0 -315
- data/lib/jamf/api/resources/collection_resources/site.rb +0 -77
- data/lib/jamf/api/resources/singleton_resources/authorization.rb +0 -88
- data/lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb +0 -139
- data/lib/jamf/api/resources/singleton_resources/reenrollment_settings.rb +0 -95
|
@@ -106,7 +106,7 @@ module JSS
|
|
|
106
106
|
# @return [void]
|
|
107
107
|
def workstation_mode=(newvalue)
|
|
108
108
|
|
|
109
|
-
raise JSS::InvalidDataError, "workstation_mode must be true or false." unless newvalue.is_a?
|
|
109
|
+
raise JSS::InvalidDataError, "workstation_mode must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
110
110
|
|
|
111
111
|
@workstation_mode = newvalue
|
|
112
112
|
|
|
@@ -125,7 +125,7 @@ module JSS
|
|
|
125
125
|
# @return [void]
|
|
126
126
|
def overwrite_existing=(newvalue)
|
|
127
127
|
|
|
128
|
-
raise JSS::InvalidDataError, "overwrite_existing must be true or false." unless newvalue.is_a?
|
|
128
|
+
raise JSS::InvalidDataError, "overwrite_existing must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
129
129
|
|
|
130
130
|
@overwrite_existing = newvalue
|
|
131
131
|
|
|
@@ -144,7 +144,7 @@ module JSS
|
|
|
144
144
|
# @return [void]
|
|
145
145
|
def update_PAM=(newvalue)
|
|
146
146
|
|
|
147
|
-
raise JSS::InvalidDataError, "update_PAM must be true or false." unless newvalue.is_a?
|
|
147
|
+
raise JSS::InvalidDataError, "update_PAM must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
148
148
|
|
|
149
149
|
@update_PAM = newvalue
|
|
150
150
|
|
|
@@ -163,9 +163,16 @@ module JSS
|
|
|
163
163
|
# @return [void]
|
|
164
164
|
def zone=(newvalue)
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
new =
|
|
167
|
+
if newvalue.to_s.empty?
|
|
168
|
+
JSS::BLANK
|
|
169
|
+
else
|
|
170
|
+
# Data Check
|
|
171
|
+
raise JSS::InvalidDataError, "zone must be a string." unless newvalue.is_a? String
|
|
172
|
+
newvalue
|
|
173
|
+
end
|
|
167
174
|
|
|
168
|
-
@zone =
|
|
175
|
+
@zone = new
|
|
169
176
|
|
|
170
177
|
self.container&.should_update
|
|
171
178
|
end
|
|
@@ -182,9 +189,16 @@ module JSS
|
|
|
182
189
|
# @return [void]
|
|
183
190
|
def preferred_domain_server=(newvalue)
|
|
184
191
|
|
|
185
|
-
|
|
192
|
+
new =
|
|
193
|
+
if newvalue.to_s.empty?
|
|
194
|
+
JSS::BLANK
|
|
195
|
+
else
|
|
196
|
+
# Data Check
|
|
197
|
+
raise JSS::InvalidDataError, "preferred_domain_server must be a string." unless newvalue.is_a? String
|
|
198
|
+
newvalue
|
|
199
|
+
end
|
|
186
200
|
|
|
187
|
-
@preferred_domain_server =
|
|
201
|
+
@preferred_domain_server = new
|
|
188
202
|
|
|
189
203
|
self.container&.should_update
|
|
190
204
|
end
|
|
@@ -93,7 +93,7 @@ module JSS
|
|
|
93
93
|
# @return [void]
|
|
94
94
|
def encrypt_using_ssl=(newvalue)
|
|
95
95
|
|
|
96
|
-
raise JSS::InvalidDataError, "encrypt_using_ssl must be true or false." unless newvalue.is_a?
|
|
96
|
+
raise JSS::InvalidDataError, "encrypt_using_ssl must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
97
97
|
|
|
98
98
|
@encrypt_using_ssl = newvalue
|
|
99
99
|
|
|
@@ -112,7 +112,7 @@ module JSS
|
|
|
112
112
|
# @return [void]
|
|
113
113
|
def perform_secure_bind=(newvalue)
|
|
114
114
|
|
|
115
|
-
raise JSS::InvalidDataError, "perform_secure_bind must be true or false." unless newvalue.is_a?
|
|
115
|
+
raise JSS::InvalidDataError, "perform_secure_bind must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
116
116
|
|
|
117
117
|
@perform_secure_bind = newvalue
|
|
118
118
|
|
|
@@ -131,7 +131,7 @@ module JSS
|
|
|
131
131
|
# @return [void]
|
|
132
132
|
def use_for_authentication=(newvalue)
|
|
133
133
|
|
|
134
|
-
raise JSS::InvalidDataError, "use_for_authentication must be true or false." unless newvalue.is_a?
|
|
134
|
+
raise JSS::InvalidDataError, "use_for_authentication must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
135
135
|
|
|
136
136
|
@use_for_authentication = newvalue
|
|
137
137
|
|
|
@@ -150,7 +150,7 @@ module JSS
|
|
|
150
150
|
# @return [void]
|
|
151
151
|
def use_for_contacts=(newvalue)
|
|
152
152
|
|
|
153
|
-
raise JSS::InvalidDataError, "use_for_contacts must be true or false." unless newvalue.is_a?
|
|
153
|
+
raise JSS::InvalidDataError, "use_for_contacts must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
154
154
|
|
|
155
155
|
@use_for_contacts = newvalue
|
|
156
156
|
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
###
|
|
25
25
|
|
|
26
26
|
module JSS
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Module Variables
|
|
29
30
|
#####################################
|
|
30
31
|
|
|
31
32
|
# Module Methods
|
|
@@ -40,98 +41,103 @@ module JSS
|
|
|
40
41
|
# @see JSS::APIObject
|
|
41
42
|
#
|
|
42
43
|
class DockItem < JSS::APIObject
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
######################
|
|
122
|
-
private
|
|
123
|
-
|
|
124
|
-
# the xml formated data for adding or updating this in the JSS
|
|
125
|
-
#
|
|
126
|
-
def rest_xml
|
|
127
|
-
doc = REXML::Document.new APIConnection::XML_HEADER
|
|
128
|
-
ns = doc.add_element RSRC_OBJECT_KEY.to_s
|
|
129
|
-
ns.add_element('name').text = @name
|
|
130
|
-
ns.add_element('type').text = @type.to_s
|
|
131
|
-
ns.add_element('path').text = @path.to_s
|
|
132
|
-
doc.to_s
|
|
133
|
-
end # rest_xml
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Mix-Ins
|
|
47
|
+
#####################################
|
|
48
|
+
include JSS::Creatable
|
|
49
|
+
include JSS::Updatable
|
|
50
|
+
|
|
51
|
+
# Class Methods
|
|
52
|
+
#####################################
|
|
53
|
+
|
|
54
|
+
# Class Constants
|
|
55
|
+
#####################################
|
|
56
|
+
|
|
57
|
+
# The Dock Item type
|
|
58
|
+
DOCK_ITEM_TYPE = %w[
|
|
59
|
+
App
|
|
60
|
+
File
|
|
61
|
+
Folder
|
|
62
|
+
].freeze
|
|
63
|
+
|
|
64
|
+
# The base for REST resources of this class
|
|
65
|
+
RSRC_BASE = 'dockitems'.freeze
|
|
66
|
+
|
|
67
|
+
# the hash key used for the JSON list output of all objects in the JSS
|
|
68
|
+
RSRC_LIST_KEY = :dock_items
|
|
69
|
+
|
|
70
|
+
# The hash key used for the JSON object output.
|
|
71
|
+
# It's also used in various error messages
|
|
72
|
+
RSRC_OBJECT_KEY = :dock_item
|
|
73
|
+
|
|
74
|
+
# the object type for this object in
|
|
75
|
+
# the object history table.
|
|
76
|
+
# See {APIObject#add_object_history_entry}
|
|
77
|
+
# OBJECT_HISTORY_OBJECT_TYPE = 41
|
|
78
|
+
|
|
79
|
+
# Attributes
|
|
80
|
+
#####################################
|
|
81
|
+
attr_reader :id
|
|
82
|
+
attr_reader :name
|
|
83
|
+
attr_reader :type
|
|
84
|
+
attr_reader :path
|
|
85
|
+
|
|
86
|
+
# Constructor
|
|
87
|
+
# @see JSS::APIObject.initialize
|
|
88
|
+
#####################################
|
|
89
|
+
def initialize(args = {})
|
|
90
|
+
super args
|
|
91
|
+
|
|
92
|
+
@type = 'App' if @init_data[:type].nil?
|
|
93
|
+
@type = @init_data[:type]
|
|
94
|
+
@path = @init_data[:path]
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Public Instance Methods
|
|
98
|
+
#####################################
|
|
99
|
+
|
|
100
|
+
# set the type
|
|
101
|
+
#
|
|
102
|
+
# @param newval[String] the new app type
|
|
103
|
+
#
|
|
104
|
+
# @return [void]
|
|
105
|
+
#
|
|
106
|
+
def type=(newval)
|
|
107
|
+
raise JSS::InvalidDataError, 'Type must be a string' unless newval.is_a? String
|
|
108
|
+
raise JSS::InvalidDataError, "Type must be one of the following: #{DOCK_ITEM_TYPE}; not #{newval}" unless DOCK_ITEM_TYPE.include? newval.to_s
|
|
109
|
+
|
|
110
|
+
@type = newval
|
|
111
|
+
@need_to_update = true
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# set the path
|
|
115
|
+
#
|
|
116
|
+
# @param newval[String] the new app path
|
|
117
|
+
def path=(newval)
|
|
118
|
+
raise JSS::InvalidDataError, 'Path must be a String' unless newval.is_a? String
|
|
119
|
+
|
|
120
|
+
@path = newval
|
|
121
|
+
@need_to_update = true
|
|
134
122
|
end
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
123
|
+
|
|
124
|
+
# private instance methods
|
|
125
|
+
######################
|
|
126
|
+
private
|
|
127
|
+
|
|
128
|
+
# the xml formated data for adding or updating this in the JSS
|
|
129
|
+
#
|
|
130
|
+
def rest_xml
|
|
131
|
+
doc = REXML::Document.new APIConnection::XML_HEADER
|
|
132
|
+
ns = doc.add_element RSRC_OBJECT_KEY.to_s
|
|
133
|
+
ns.add_element('name').text = @name
|
|
134
|
+
ns.add_element('type').text = @type.to_s
|
|
135
|
+
ns.add_element('path').text = @path.to_s
|
|
136
|
+
doc.to_s
|
|
137
|
+
end # rest_xml
|
|
138
|
+
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
end
|
data/lib/jss/api_object/ebook.rb
CHANGED
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
#
|
|
24
24
|
#
|
|
25
25
|
|
|
26
|
-
#
|
|
27
26
|
module JSS
|
|
28
27
|
|
|
29
28
|
# Sub-Modules
|
|
@@ -221,6 +220,7 @@ module JSS
|
|
|
221
220
|
eaxml = REXML::Element.new('extension_attributes')
|
|
222
221
|
@extension_attributes.each do |ea|
|
|
223
222
|
next unless @changed_eas.include? ea[:name]
|
|
223
|
+
|
|
224
224
|
ea_el = eaxml.add_element('extension_attribute')
|
|
225
225
|
ea_el.add_element('name').text = ea[:name]
|
|
226
226
|
|
|
@@ -179,9 +179,10 @@ module JSS
|
|
|
179
179
|
# deprecated - no longer in the UI
|
|
180
180
|
@recon_display = @init_data[:recon_display] || @web_display
|
|
181
181
|
|
|
182
|
-
#
|
|
183
|
-
#
|
|
184
|
-
|
|
182
|
+
# When used in Advanced Search results, the EA name
|
|
183
|
+
# has colons removed, spaces & dashes turned to underscores.
|
|
184
|
+
# and then ruby-jss symbolizes the name.
|
|
185
|
+
@symbolized_name = @name.gsub(':', '').gsub(/-| /, '_').to_sym
|
|
185
186
|
end # init
|
|
186
187
|
|
|
187
188
|
# Public Instance Methods
|
data/lib/jss/api_object/group.rb
CHANGED
|
@@ -241,7 +241,7 @@ module JSS
|
|
|
241
241
|
#
|
|
242
242
|
# @param retries [Integer] If calculate_members is true, refetching the
|
|
243
243
|
# group to re-read the membership can happen too fast, the JSS won't know
|
|
244
|
-
# it exists yet and will throw a
|
|
244
|
+
# it exists yet and will throw a NoSuchItem error. If that
|
|
245
245
|
# happens, try again this many times with a 1 second pause between attempts.
|
|
246
246
|
#
|
|
247
247
|
def create(calculate_members: true, retries: 10)
|
|
@@ -256,7 +256,7 @@ module JSS
|
|
|
256
256
|
begin
|
|
257
257
|
refresh_members
|
|
258
258
|
break
|
|
259
|
-
rescue
|
|
259
|
+
rescue
|
|
260
260
|
sleep 1
|
|
261
261
|
tries += 1
|
|
262
262
|
end # begin
|
|
@@ -311,6 +311,37 @@ module JSS
|
|
|
311
311
|
super
|
|
312
312
|
end
|
|
313
313
|
|
|
314
|
+
# Change static group to smart group
|
|
315
|
+
#
|
|
316
|
+
# @param args[Hash] the options and settings use for switching the computer group from static group to smart group
|
|
317
|
+
#
|
|
318
|
+
# @option args criteria[Array] The criterias to be user for the smart group
|
|
319
|
+
def set_smart(*params)
|
|
320
|
+
return if @is_smart
|
|
321
|
+
|
|
322
|
+
params[:criteria] = [] if params[:criteria].nil?
|
|
323
|
+
|
|
324
|
+
criteria = params[:criteria]
|
|
325
|
+
|
|
326
|
+
@is_smart = true
|
|
327
|
+
@need_to_update = true
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
# Change smart group to static group
|
|
331
|
+
#
|
|
332
|
+
# @param args[Hash] the options and settings use for switching the computer group from smart group to static group
|
|
333
|
+
#
|
|
334
|
+
# @option args preserve_members[Boolean] Should the smart group preserve it's current members?
|
|
335
|
+
def set_static(*params)
|
|
336
|
+
return unless @is_smart
|
|
337
|
+
|
|
338
|
+
preserve_members = params.include? :preserve_members
|
|
339
|
+
|
|
340
|
+
@is_smart = false
|
|
341
|
+
|
|
342
|
+
clear() unless preserve_members
|
|
343
|
+
end
|
|
344
|
+
|
|
314
345
|
# How many members of the group?
|
|
315
346
|
#
|
|
316
347
|
# @return [Integer] the number of members of the group
|
|
@@ -22,15 +22,19 @@
|
|
|
22
22
|
### language governing permissions and limitations under the Apache License.
|
|
23
23
|
###
|
|
24
24
|
|
|
25
|
-
# This is just a stub for now.
|
|
26
|
-
|
|
27
|
-
#
|
|
28
25
|
module JSS
|
|
29
26
|
|
|
30
|
-
#
|
|
31
|
-
class MacApplication < APIObject
|
|
27
|
+
# This is just a stub for now.
|
|
28
|
+
class MacApplication < JSS::APIObject
|
|
32
29
|
|
|
33
|
-
|
|
30
|
+
# Mix-Ins
|
|
31
|
+
#####################################
|
|
32
|
+
include JSS::Updatable
|
|
33
|
+
include JSS::Scopable
|
|
34
|
+
include JSS::SelfServable
|
|
35
|
+
include JSS::Categorizable
|
|
36
|
+
include JSS::VPPable
|
|
37
|
+
include JSS::Sitable
|
|
34
38
|
|
|
35
39
|
### The base for REST resources of this class
|
|
36
40
|
RSRC_BASE = 'macapplications'.freeze
|
|
@@ -47,9 +51,104 @@ module JSS
|
|
|
47
51
|
# See {APIObject#add_object_history_entry}
|
|
48
52
|
OBJECT_HISTORY_OBJECT_TYPE = 350
|
|
49
53
|
|
|
54
|
+
# See JSS::Scopable
|
|
55
|
+
SCOPE_TARGET_KEY = :computers
|
|
56
|
+
|
|
57
|
+
# Where is the Category in the API JSON?
|
|
58
|
+
CATEGORY_SUBSET = :general
|
|
59
|
+
|
|
60
|
+
# How is the category stored in the API data?
|
|
61
|
+
CATEGORY_DATA_TYPE = Hash
|
|
62
|
+
|
|
50
63
|
# Where is the Site data in the API JSON?
|
|
51
64
|
SITE_SUBSET = :general
|
|
52
65
|
|
|
53
|
-
|
|
66
|
+
# Attributes
|
|
67
|
+
#############################################
|
|
68
|
+
|
|
69
|
+
# @return [String]
|
|
70
|
+
attr_reader :version
|
|
71
|
+
|
|
72
|
+
# @return [Boolean]
|
|
73
|
+
attr_reader :is_free
|
|
74
|
+
alias free? is_free
|
|
75
|
+
|
|
76
|
+
# @return [String]
|
|
77
|
+
attr_reader :bundle_id
|
|
78
|
+
|
|
79
|
+
# @return [String]
|
|
80
|
+
attr_reader :url
|
|
81
|
+
|
|
82
|
+
## Constructor
|
|
83
|
+
#####################################
|
|
84
|
+
|
|
85
|
+
def initialize(args = {})
|
|
86
|
+
super
|
|
87
|
+
general = @init_data[:general]
|
|
88
|
+
@version = general[:version]
|
|
89
|
+
@is_free = general[:is_free]
|
|
90
|
+
@bundle_id = general[:bundle_id]
|
|
91
|
+
@url = general[:url]
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Overrides, because consistency isn't alway a thing in the
|
|
95
|
+
# classic API
|
|
96
|
+
#############################################
|
|
97
|
+
|
|
98
|
+
# Override self_service_display_name getter
|
|
99
|
+
def self_service_display_name
|
|
100
|
+
raise JSS::UnsupportedError, 'MacApplications do not have separate display names. Please use the object name.'
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Override self_service_display_name setter
|
|
104
|
+
def self_service_display_name=(_newname)
|
|
105
|
+
raise JSS::UnsupportedError, 'MacApplications do not have separate display names. Please use the object name.'
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Override reinstall_button_text getter
|
|
109
|
+
def reinstall_button_text
|
|
110
|
+
raise JSS::UnsupportedError, 'MacApplications do not have separate text for reinstall buttons. Please use install_button_text.'
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Override reinstall_button_text setter
|
|
114
|
+
def reinstall_button_text=(_new)
|
|
115
|
+
raise JSS::UnsupportedError, 'MacApplications do not have separate text for reinstall buttons. Please use install_button_text.'
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Alas, SSvc icons are not uploadable via the API for
|
|
119
|
+
# mac apps
|
|
120
|
+
def upload(_type, _local_file)
|
|
121
|
+
raise JSS::UnsupportedError, 'The Classic API does not support uploading icons for MacApplications. Please use the Web UI'
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
## Private Instance Methods
|
|
125
|
+
#####################################
|
|
126
|
+
private
|
|
127
|
+
|
|
128
|
+
### Return the xml for creating or updating this script in the JSS
|
|
129
|
+
###
|
|
130
|
+
def rest_xml
|
|
131
|
+
doc = REXML::Document.new APIConnection::XML_HEADER
|
|
132
|
+
obj = doc.add_element RSRC_OBJECT_KEY.to_s
|
|
133
|
+
|
|
134
|
+
general = obj.add_element('general')
|
|
135
|
+
|
|
136
|
+
general.add_element('version').text = @version
|
|
137
|
+
general.add_element('is_free').text = @is_free.to_s
|
|
138
|
+
general.add_element('bundle_id').text = @bundle_id
|
|
139
|
+
general.add_element('url').text = @url
|
|
140
|
+
|
|
141
|
+
obj << @scope.scope_xml
|
|
142
|
+
|
|
143
|
+
add_self_service_xml doc
|
|
144
|
+
add_category_to_xml doc
|
|
145
|
+
add_site_to_xml doc
|
|
146
|
+
add_vpp_xml doc
|
|
147
|
+
|
|
148
|
+
doc.to_s
|
|
149
|
+
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
end # class MacApplication
|
|
54
153
|
|
|
55
|
-
end
|
|
154
|
+
end # Module JSS
|