ruby-jss 1.0.2 → 1.0.3b1

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.

@@ -144,7 +144,11 @@ module JSS
144
144
  # decode the icon data, or grab from
145
145
  # the URI if needed
146
146
  @data = Base64.decode64(@data) if @data
147
- @data ||= open(@uri).read if @uri
147
+ begin
148
+ @data ||= URI.parse(@uri).read if @uri
149
+ rescue
150
+ @data = nil
151
+ end
148
152
 
149
153
  end
150
154
 
@@ -75,6 +75,9 @@ module JSS
75
75
  # the ps command used to figure out who's running Self Service
76
76
  PS_USER_COMM = 'ps -A -o user,comm'.freeze
77
77
 
78
+ # the path to a users byhost folder from home
79
+ USER_PREFS_BYHOST_FOLDER = 'Library/Preferences/ByHost/'
80
+
78
81
  # Class Methods
79
82
  #####################################
80
83
 
@@ -245,7 +248,8 @@ module JSS
245
248
  #
246
249
  def self.primary_console_user
247
250
  `#{CONSOLE_USERS_SCUTIL_CMD}` =~ /^\s*Name : (\S+)$/
248
- Regexp.last_match(1) == LOGINWINDOW_USER ? nil : user
251
+ user = Regexp.last_match(1)
252
+ user == LOGINWINDOW_USER ? nil : user
249
253
  end
250
254
 
251
255
  # alias for primary_console_user
@@ -263,6 +267,31 @@ module JSS
263
267
  ss_userlines.map { |ssl| ssl.split(' ').first }
264
268
  end
265
269
 
270
+ # @param user[String, nil] The user to query, the current user if nil.
271
+ #
272
+ # @return [Boolean, nil] Is 'Do Not Disturb' enabled for the user?
273
+ # nil if unknown/not-applicable
274
+ #
275
+ def self.do_not_disturb?(user = nil)
276
+ home = user ? homedir(user) : Dir.home
277
+ myudid = udid
278
+ nc_prefs_file = Pathname.new "#{home}/#{USER_PREFS_BYHOST_FOLDER}/com.apple.notificationcenterui.#{myudid}.plist"
279
+ return nil unless nc_prefs_file.readable?
280
+ JSS.parse_plist(nc_prefs_file)['doNotDisturb']
281
+ end
282
+
283
+ # The home dir of the specified user, nil if
284
+ # no homedir in local dscl.
285
+ #
286
+ # @param user[String] the user whose homedir to look up
287
+ #
288
+ # @return [Pathname, nil] The user's homedir or nil if no such user
289
+ #
290
+ def self.homedir(user)
291
+ dir = `/usr/bin/dscl . -read /Users/#{user} NFSHomeDirectory 2>/dev/null`.chomp.split(': ').last
292
+ dir ? Pathname.new(dir) : nil
293
+ end
294
+
266
295
  end # class Client
267
296
 
268
297
  end # module
@@ -26,7 +26,7 @@
26
26
  ###
27
27
  module JSS
28
28
 
29
- #
29
+ # jamf client computer
30
30
  class Client
31
31
 
32
32
  # Constants
@@ -49,7 +49,7 @@ module JSS
49
49
  PKGBUILD = Pathname.new '/usr/bin/pkgbuild'
50
50
 
51
51
  ### the default bundle identifier prefix for pkgs
52
- PKG_BUNDLE_ID_PFX = 'jss_gem_composer'.freeze
52
+ PKG_BUNDLE_ID_PFX = 'ruby-jss-composer'.freeze
53
53
 
54
54
  ### Apple's hdiutil for making dmgs
55
55
  HDI_UTIL = '/usr/bin/hdiutil'.freeze
@@ -27,6 +27,6 @@
27
27
  module JSS
28
28
 
29
29
  ### The version of the JSS ruby gem
30
- VERSION = '1.0.2'.freeze
30
+ VERSION = '1.0.3b1'.freeze
31
31
 
32
32
  end # module
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: 1.0.2
4
+ version: 1.0.3b1
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-10-16 00:00:00.000000000 Z
12
+ date: 2018-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plist
@@ -83,42 +83,42 @@ dependencies:
83
83
  name: immutable-struct
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '2.3'
89
86
  - - ">="
90
87
  - !ruby/object:Gem::Version
91
88
  version: 2.3.0
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '2.3'
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - "~>"
97
- - !ruby/object:Gem::Version
98
- version: '2.3'
99
96
  - - ">="
100
97
  - !ruby/object:Gem::Version
101
98
  version: 2.3.0
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '2.3'
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: recursive-open-struct
104
104
  requirement: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - "~>"
107
- - !ruby/object:Gem::Version
108
- version: '1.1'
109
106
  - - ">="
110
107
  - !ruby/object:Gem::Version
111
108
  version: 1.1.0
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '1.1'
112
112
  type: :runtime
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - "~>"
117
- - !ruby/object:Gem::Version
118
- version: '1.1'
119
116
  - - ">="
120
117
  - !ruby/object:Gem::Version
121
118
  version: 1.1.0
119
+ - - "~>"
120
+ - !ruby/object:Gem::Version
121
+ version: '1.1'
122
122
  description: |2
123
123
  The ruby-jss gem provides the JSS module, a framework for interacting with the REST API
124
124
  of the Jamf Software Server (JSS), the core of Jamf Pro, an enterprise/education
@@ -285,12 +285,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
285
285
  version: 2.0.0
286
286
  required_rubygems_version: !ruby/object:Gem::Requirement
287
287
  requirements:
288
- - - ">="
288
+ - - ">"
289
289
  - !ruby/object:Gem::Version
290
- version: '0'
290
+ version: 1.3.1
291
291
  requirements: []
292
292
  rubyforge_project:
293
- rubygems_version: 2.7.7
293
+ rubygems_version: 2.7.8
294
294
  signing_key:
295
295
  specification_version: 4
296
296
  summary: A Ruby interface to the Jamf Pro REST API