ruby-jss 0.10.2a5 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ruby-jss might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGES.md +5 -0
- data/lib/jss/api_connection.rb +19 -38
- data/lib/jss/api_object/advanced_search.rb +1 -5
- data/lib/jss/api_object/computer.rb +292 -316
- data/lib/jss/api_object/computer_invitation.rb +3 -5
- data/lib/jss/api_object/ebook.rb +0 -5
- data/lib/jss/api_object/group/computer_group.rb +0 -4
- data/lib/jss/api_object/group/mobile_device_group.rb +1 -4
- data/lib/jss/api_object/group.rb +1 -6
- data/lib/jss/api_object/mac_application.rb +0 -5
- data/lib/jss/api_object/mobile_device.rb +336 -57
- data/lib/jss/api_object/mobile_device_application.rb +0 -6
- data/lib/jss/api_object/mobile_device_configuration_profile.rb +0 -36
- data/lib/jss/api_object/osx_configuration_profile.rb +151 -115
- data/lib/jss/api_object/peripheral.rb +7 -5
- data/lib/jss/api_object/policy.rb +0 -5
- data/lib/jss/api_object/restricted_software.rb +0 -5
- data/lib/jss/api_object/scopable/scope.rb +411 -367
- data/lib/jss/api_object/self_servable.rb +4 -15
- data/lib/jss/api_object/site.rb +76 -45
- data/lib/jss/api_object/user.rb +3 -7
- data/lib/jss/api_object.rb +4 -74
- data/lib/jss/utility.rb +0 -21
- data/lib/jss/version.rb +1 -1
- data/lib/jss.rb +0 -4
- metadata +6 -10
- data/lib/jss/api_object/mdm.rb +0 -1268
- data/lib/jss/api_object/patch.rb +0 -38
- data/lib/jss/api_object/patch_policy.rb +0 -38
- data/lib/jss/api_object/sitable.rb +0 -197
@@ -61,7 +61,7 @@ module JSS
|
|
61
61
|
#
|
62
62
|
#
|
63
63
|
# Classes including this module *MUST*:
|
64
|
-
# - call {#add_self_service_xml(
|
64
|
+
# - call {#add_self_service_xml()} in their #rest_xml method
|
65
65
|
#
|
66
66
|
# IMPORTANT: Since SelfServable also includes #{JSS::Updatable}, for uploading icons,
|
67
67
|
# see that module for its requirements.
|
@@ -85,8 +85,6 @@ module JSS
|
|
85
85
|
MAKE_AVAILABLE = 'Make Available in Self Service'.freeze
|
86
86
|
AUTO_INSTALL = 'Install Automatically'.freeze
|
87
87
|
AUTO_INSTALL_OR_PROMPT = 'Install Automatically/Prompt Users to Install'.freeze
|
88
|
-
PATCHPOL_SELF_SERVICE = 'selfservice'.freeze # 'Make Available in Self Service' in the UI
|
89
|
-
PATCHPOL_AUTO = 'prompt'.freeze # 'Install Automatically' in the UI
|
90
88
|
|
91
89
|
DEFAULT_INSTALL_BUTTON_TEXT = 'Install'.freeze
|
92
90
|
|
@@ -100,15 +98,6 @@ module JSS
|
|
100
98
|
can_display_in_categories: true,
|
101
99
|
can_feature_in_categories: true
|
102
100
|
},
|
103
|
-
JSS::PatchPolicy => {
|
104
|
-
in_self_service_data_path: [:general, :distribution_method],
|
105
|
-
in_self_service: PATCHPOL_SELF_SERVICE,
|
106
|
-
not_in_self_service: PATCHPOL_AUTO,
|
107
|
-
targets: [:macos],
|
108
|
-
payload: :patchpolicy,
|
109
|
-
can_display_in_categories: false,
|
110
|
-
can_feature_in_categories: false
|
111
|
-
},
|
112
101
|
JSS::MacApplication => { # TODO: add the correct values when Jamf fixes this bug
|
113
102
|
in_self_service_data_path: nil, # [:general, :distribution_method],
|
114
103
|
in_self_service: nil, # MAKE_AVAILABLE,
|
@@ -482,10 +471,10 @@ module JSS
|
|
482
471
|
end
|
483
472
|
|
484
473
|
def validate_icon(id)
|
485
|
-
|
486
|
-
|
474
|
+
if JSS::DB_CNX.connected?
|
475
|
+
raise JSS::NoSuchItemError, "No icon with id #{new_icon}" unless JSS::Icon.all_ids.include? id
|
476
|
+
end
|
487
477
|
end
|
488
|
-
|
489
478
|
# Re-read the icon data for this object from the API
|
490
479
|
# Generally done after uploading a new icon via {#icon=}
|
491
480
|
#
|
data/lib/jss/api_object/site.rb
CHANGED
@@ -1,68 +1,99 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
1
|
+
### Copyright 2017 Pixar
|
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
|
+
###
|
27
27
|
module JSS
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
#####################################
|
30
|
+
### Module Variables
|
31
|
+
#####################################
|
32
|
+
|
33
|
+
#####################################
|
34
|
+
### Module Methods
|
35
|
+
#####################################
|
31
36
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
|
38
|
+
#####################################
|
39
|
+
### Classes
|
40
|
+
#####################################
|
41
|
+
|
42
|
+
###
|
43
|
+
### A Site in the JSS.
|
44
|
+
###
|
45
|
+
### These are simple, in that they only have an ID and a name.
|
46
|
+
###
|
47
|
+
### @see JSS::APIObject
|
48
|
+
###
|
38
49
|
class Site < JSS::APIObject
|
39
50
|
|
40
|
-
|
41
|
-
|
51
|
+
#####################################
|
52
|
+
### Mix-Ins
|
53
|
+
#####################################
|
42
54
|
include JSS::Creatable
|
43
55
|
include JSS::Updatable
|
44
56
|
|
45
|
-
|
46
|
-
|
57
|
+
#####################################
|
58
|
+
### Class Methods
|
59
|
+
#####################################
|
60
|
+
|
61
|
+
#####################################
|
62
|
+
### Class Constants
|
63
|
+
#####################################
|
47
64
|
|
48
|
-
|
49
|
-
RSRC_BASE =
|
65
|
+
### The base for REST resources of this class
|
66
|
+
RSRC_BASE = "sites"
|
50
67
|
|
51
|
-
|
68
|
+
### the hash key used for the JSON list output of all objects in the JSS
|
52
69
|
RSRC_LIST_KEY = :sites
|
53
70
|
|
54
|
-
|
55
|
-
|
71
|
+
### The hash key used for the JSON object output.
|
72
|
+
### It's also used in various error messages
|
56
73
|
RSRC_OBJECT_KEY = :site
|
57
74
|
|
58
|
-
|
59
|
-
VALID_DATA_KEYS = []
|
75
|
+
### these keys, as well as :id and :name, are present in valid API JSON data for this class
|
76
|
+
VALID_DATA_KEYS = []
|
60
77
|
|
61
78
|
# the object type for this object in
|
62
79
|
# the object history table.
|
63
80
|
# See {APIObject#add_object_history_entry}
|
64
81
|
OBJECT_HISTORY_OBJECT_TYPE = 44
|
65
82
|
|
83
|
+
#####################################
|
84
|
+
### Attributes
|
85
|
+
#####################################
|
86
|
+
|
87
|
+
#####################################
|
88
|
+
### Constructor
|
89
|
+
#####################################
|
90
|
+
|
91
|
+
|
92
|
+
#####################################
|
93
|
+
### Public Instance Methods
|
94
|
+
#####################################
|
95
|
+
|
96
|
+
|
66
97
|
end # class site
|
67
98
|
|
68
99
|
end # module
|
data/lib/jss/api_object/user.rb
CHANGED
@@ -106,13 +106,9 @@ module JSS
|
|
106
106
|
|
107
107
|
### @return [Array<Hash>]
|
108
108
|
###
|
109
|
-
###
|
110
|
-
### can be in multiple sites, so we don't use
|
111
|
-
### the Sitable mixin module. Instead we'll
|
112
|
-
### we'll store them in this Array, as they come
|
113
|
-
### from the API.
|
109
|
+
### The sites associated with this user
|
114
110
|
###
|
115
|
-
### Each Hash has
|
111
|
+
### Each Hash has then :id and :name for one site
|
116
112
|
###
|
117
113
|
attr_reader :sites
|
118
114
|
|
@@ -271,7 +267,7 @@ module JSS
|
|
271
267
|
|
272
268
|
user << JSS::Site.xml_list(@sites)
|
273
269
|
|
274
|
-
user << ext_attr_xml
|
270
|
+
user << ext_attr_xml if @changed_eas && !@changed_eas.empty?
|
275
271
|
|
276
272
|
return doc.to_s
|
277
273
|
end
|
data/lib/jss/api_object.rb
CHANGED
@@ -483,47 +483,6 @@ module JSS
|
|
483
483
|
new args
|
484
484
|
end
|
485
485
|
|
486
|
-
|
487
|
-
# Delete one or more API objects by jss_id without instantiating them.
|
488
|
-
# Non-existent id's are skipped and an array of skipped ids is returned.
|
489
|
-
#
|
490
|
-
# If an Array is provided, it is passed through #uniq! before being processed.
|
491
|
-
#
|
492
|
-
# @param victims[Integer,Array<Integer>] An object id or an array of them
|
493
|
-
# to be deleted
|
494
|
-
#
|
495
|
-
# @param api[JSS::APIConnection] the API connection to use.
|
496
|
-
# Defaults to the corrently active API. See {JSS::APIConnection}
|
497
|
-
#
|
498
|
-
# @return [Array<Integer>] The id's that didn't exist when we tried to
|
499
|
-
# delete them.
|
500
|
-
#
|
501
|
-
def self.delete(victims, api: JSS.api)
|
502
|
-
raise JSS::UnsupportedError, '.delete can only be called on subclasses of JSS::APIObject' if self == JSS::APIObject
|
503
|
-
raise JSS::InvalidDataError, 'Parameter must be an Integer ID or an Array of them' unless victims.is_a?(Integer) || victims.is_a?(Array)
|
504
|
-
|
505
|
-
case victims
|
506
|
-
when Integer
|
507
|
-
victims = [victims]
|
508
|
-
when Fixnum
|
509
|
-
victims = [victims]
|
510
|
-
when Array
|
511
|
-
victims.uniq!
|
512
|
-
end
|
513
|
-
|
514
|
-
skipped = []
|
515
|
-
current_ids = all_ids :refresh, api: api
|
516
|
-
victims.each do |vid|
|
517
|
-
if current_ids.include? vid
|
518
|
-
api.delete_rsrc "#{self::RSRC_BASE}/id/#{vid}"
|
519
|
-
else
|
520
|
-
skipped << vid
|
521
|
-
end # if current_ids include v
|
522
|
-
end # each victim
|
523
|
-
|
524
|
-
skipped
|
525
|
-
end # self.delete
|
526
|
-
|
527
486
|
### Class Constants
|
528
487
|
#####################################
|
529
488
|
|
@@ -695,16 +654,11 @@ module JSS
|
|
695
654
|
defined? self.class::SELF_SERVABLE
|
696
655
|
end
|
697
656
|
|
698
|
-
# @return [Boolean] See {JSS::
|
657
|
+
# @return [Boolean] See {JSS::criteriable}
|
699
658
|
def criterable?
|
700
659
|
defined? self.class::CRITERIABLE
|
701
660
|
end
|
702
661
|
|
703
|
-
# @return [Boolean] See {JSS::Sitable}
|
704
|
-
def sitable?
|
705
|
-
defined? self.class::SITABLE
|
706
|
-
end
|
707
|
-
|
708
662
|
# @return [Boolean] See {JSS::extendable}
|
709
663
|
def extendable?
|
710
664
|
defined? self.class::EXTENDABLE
|
@@ -737,8 +691,8 @@ module JSS
|
|
737
691
|
|
738
692
|
# Delete this item from the JSS.
|
739
693
|
#
|
740
|
-
#
|
741
|
-
#
|
694
|
+
# TODO: Make a class method for mass deletion
|
695
|
+
# without instantiating, then call it from this method.
|
742
696
|
#
|
743
697
|
# Subclasses may want to redefine this method,
|
744
698
|
# first calling super, then setting other attributes to
|
@@ -861,17 +815,6 @@ module JSS
|
|
861
815
|
history
|
862
816
|
end
|
863
817
|
|
864
|
-
# Print the rest_xml value of the object to stdout,
|
865
|
-
# with indentation. Useful for debugging.
|
866
|
-
#
|
867
|
-
# @return [void]
|
868
|
-
#
|
869
|
-
def ppx
|
870
|
-
return nil unless creatable? || updatable?
|
871
|
-
REXML::Document.new(rest_xml).write $stdout, 2
|
872
|
-
puts
|
873
|
-
end
|
874
|
-
|
875
818
|
# Private Instance Methods
|
876
819
|
#####################################
|
877
820
|
private
|
@@ -977,11 +920,10 @@ module JSS
|
|
977
920
|
# many things have a :site
|
978
921
|
# TODO: Implement a Sitable mixin module
|
979
922
|
#
|
980
|
-
|
923
|
+
@site = JSS::APIObject.get_name(@main_subset[:site]) if @main_subset[:site]
|
981
924
|
|
982
925
|
##### Handle Mix-ins
|
983
926
|
initialize_category
|
984
|
-
initialize_site
|
985
927
|
initialize_location
|
986
928
|
initialize_purchasing
|
987
929
|
initialize_scope
|
@@ -1017,14 +959,6 @@ module JSS
|
|
1017
959
|
parse_category if categorizable?
|
1018
960
|
end
|
1019
961
|
|
1020
|
-
# parse site data during initialization
|
1021
|
-
#
|
1022
|
-
# @return [void]
|
1023
|
-
#
|
1024
|
-
def initialize_site
|
1025
|
-
parse_site if sitable?
|
1026
|
-
end
|
1027
|
-
|
1028
962
|
# parse location data during initialization
|
1029
963
|
#
|
1030
964
|
# @return [void]
|
@@ -1129,8 +1063,6 @@ require 'jss/api_object/extendable'
|
|
1129
1063
|
require 'jss/api_object/self_servable'
|
1130
1064
|
require 'jss/api_object/categorizable'
|
1131
1065
|
require 'jss/api_object/vppable'
|
1132
|
-
require 'jss/api_object/sitable'
|
1133
|
-
require 'jss/api_object/mdm'
|
1134
1066
|
|
1135
1067
|
### Mix-in Sub Modules with Classes
|
1136
1068
|
require 'jss/api_object/criteriable'
|
@@ -1159,8 +1091,6 @@ require 'jss/api_object/netboot_server'
|
|
1159
1091
|
require 'jss/api_object/network_segment'
|
1160
1092
|
require 'jss/api_object/osx_configuration_profile'
|
1161
1093
|
require 'jss/api_object/package'
|
1162
|
-
require 'jss/api_object/patch'
|
1163
|
-
require 'jss/api_object/patch_policy'
|
1164
1094
|
require 'jss/api_object/peripheral_type'
|
1165
1095
|
require 'jss/api_object/peripheral'
|
1166
1096
|
require 'jss/api_object/policy'
|
data/lib/jss/utility.rb
CHANGED
@@ -558,25 +558,4 @@ module JSS
|
|
558
558
|
pw
|
559
559
|
end
|
560
560
|
|
561
|
-
# un/set devmode mode.
|
562
|
-
# Useful when coding - methods can call JSS.devmode? and then
|
563
|
-
# e.g. spit out something instead of performing some action.
|
564
|
-
#
|
565
|
-
# @param [Symbol] Set devmode :on or :off
|
566
|
-
#
|
567
|
-
# @return [Boolean] The new state of devmode
|
568
|
-
#
|
569
|
-
def self.devmode(setting)
|
570
|
-
@devmode = setting == :on ? true : false
|
571
|
-
end
|
572
|
-
|
573
|
-
|
574
|
-
# is devmode currently on?
|
575
|
-
#
|
576
|
-
# @return [Boolean]
|
577
|
-
#
|
578
|
-
def self.devmode?
|
579
|
-
@devmode
|
580
|
-
end
|
581
|
-
|
582
561
|
end # module
|
data/lib/jss/version.rb
CHANGED
data/lib/jss.rb
CHANGED
@@ -160,8 +160,6 @@ module JSS
|
|
160
160
|
class NetworkSegment < JSS::APIObject; end
|
161
161
|
class OSXConfigurationProfile < JSS::APIObject; end
|
162
162
|
class Package < JSS::APIObject; end
|
163
|
-
class Patch < JSS::APIObject; end
|
164
|
-
class PatchPolicy < JSS::APIObject; end
|
165
163
|
class PeripheralType < JSS::APIObject; end
|
166
164
|
class Peripheral < JSS::APIObject; end
|
167
165
|
class Policy < JSS::APIObject; end
|
@@ -185,8 +183,6 @@ module JSS
|
|
185
183
|
module SelfServable; end
|
186
184
|
module Categorizable; end
|
187
185
|
module VPPable; end
|
188
|
-
module Sitable; end
|
189
|
-
module MDM; end
|
190
186
|
|
191
187
|
end # module JSS
|
192
188
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-jss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Lasell
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: plist
|
@@ -71,14 +71,14 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0.
|
74
|
+
version: '0.8'
|
75
75
|
type: :runtime
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0.
|
81
|
+
version: '0.8'
|
82
82
|
description: |2
|
83
83
|
The ruby-jss gem provides the JSS module, a framework for interacting with the REST API
|
84
84
|
of the Jamf Software Server (JSS), the core of Jamf Pro, an enterprise/education
|
@@ -140,7 +140,6 @@ files:
|
|
140
140
|
- lib/jss/api_object/locatable.rb
|
141
141
|
- lib/jss/api_object/mac_application.rb
|
142
142
|
- lib/jss/api_object/matchable.rb
|
143
|
-
- lib/jss/api_object/mdm.rb
|
144
143
|
- lib/jss/api_object/mobile_device.rb
|
145
144
|
- lib/jss/api_object/mobile_device_application.rb
|
146
145
|
- lib/jss/api_object/mobile_device_configuration_profile.rb
|
@@ -148,8 +147,6 @@ files:
|
|
148
147
|
- lib/jss/api_object/network_segment.rb
|
149
148
|
- lib/jss/api_object/osx_configuration_profile.rb
|
150
149
|
- lib/jss/api_object/package.rb
|
151
|
-
- lib/jss/api_object/patch.rb
|
152
|
-
- lib/jss/api_object/patch_policy.rb
|
153
150
|
- lib/jss/api_object/peripheral.rb
|
154
151
|
- lib/jss/api_object/peripheral_type.rb
|
155
152
|
- lib/jss/api_object/policy.rb
|
@@ -161,7 +158,6 @@ files:
|
|
161
158
|
- lib/jss/api_object/script.rb
|
162
159
|
- lib/jss/api_object/self_servable.rb
|
163
160
|
- lib/jss/api_object/self_servable/icon.rb
|
164
|
-
- lib/jss/api_object/sitable.rb
|
165
161
|
- lib/jss/api_object/site.rb
|
166
162
|
- lib/jss/api_object/software_update_server.rb
|
167
163
|
- lib/jss/api_object/updatable.rb
|
@@ -209,9 +205,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
205
|
version: 1.9.3
|
210
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
207
|
requirements:
|
212
|
-
- - "
|
208
|
+
- - ">="
|
213
209
|
- !ruby/object:Gem::Version
|
214
|
-
version:
|
210
|
+
version: '0'
|
215
211
|
requirements: []
|
216
212
|
rubyforge_project:
|
217
213
|
rubygems_version: 2.6.8
|