class Jamf::Account

A User or group in the JSS.

TODO: Split this into 2 classes, with lots of custom code. Thanks Jamf!

@see Jamf::APIObject

Constants

OTHER_LOOKUP_KEYS

these keys, as well as :id and :name, can be used to look up objects of this class in the JSS

RSRC_BASE

The base for REST resources of this class

RSRC_LIST_KEY

the hash key used for the JSON list output of all objects in the JSS

RSRC_OBJECT_KEY

The hash key used for the JSON object output. It’s also used in various error messages

Attributes

access_level[R]

@return [String] The user’s access level

email[R]

@return [String] The user’s email address

full_name[R]

@return [String] The user’s full name

privilege_set[R]

@return [String] The user’s privilege set

privileges[R]

@return [Hash]

Info about the privileges assigned to the user

Note: these arrays may be empty, they always exist

The Hash keys are:

  • :jss_objects => An array of jss_object privileges

  • :jss_settings => An array of jss_settings privileges

  • :jss_actions => An array of jss_actions privileges

  • :recon => An array of Casper Recon privileges

  • :casper_admin => An array of Casper Admin privileges

  • :casper_remote => An array of Casper Remote privileges

  • :casper_imaging => An array of Casper Imaging privileges

Public Class Methods

all_group_ids(refresh = false, api: nil, cnx: Jamf.cnx) click to toggle source

@return [Array<Hash>] all JSS account group ids

    # File lib/jamf/api/classic/api_objects/account.rb
113 def self.all_group_ids(refresh = false,  api: nil, cnx: Jamf.cnx)
114   cnx = api if api
115   all(refresh, cnx: cnx)[:groups].map { |i| i[:id] }
116 end
all_group_names(refresh = false, api: nil, cnx: Jamf.cnx) click to toggle source

@return [Array<Hash>] all JSS account group names

    # File lib/jamf/api/classic/api_objects/account.rb
119 def self.all_group_names(refresh = false,  api: nil, cnx: Jamf.cnx)
120   cnx = api if api
121   all(refresh, cnx: cnx)[:groups].map { |i| i[:name] }
122 end
all_groups(refresh = false, api: nil, cnx: Jamf.cnx) click to toggle source

@return [Array<Hash>] all JSS account groups

    # File lib/jamf/api/classic/api_objects/account.rb
107 def self.all_groups(refresh = false,  api: nil, cnx: Jamf.cnx)
108   cnx = api if api
109   all(refresh, cnx: cnx)[:groups]
110 end
all_ids(_refresh = false, **_bunk) click to toggle source

override auto-defined method

   # File lib/jamf/api/classic/api_objects/account.rb
79 def self.all_ids(_refresh = false, **_bunk)
80   raise '.all_ids is not valid for Jamf::Account, use .all_user_ids or .all_group_ids'
81 end
all_names(_refresh = false, **_bunk) click to toggle source

override auto-defined method

   # File lib/jamf/api/classic/api_objects/account.rb
84 def self.all_names(_refresh = false, **_bunk)
85   raise '.all_names is not valid for Jamf::Account, use .all_user_names or .all_group_names'
86 end
all_user_ids(refresh = false, api: nil, cnx: Jamf.cnx) click to toggle source

@return [Array<Hash>] all JSS account user ids

   # File lib/jamf/api/classic/api_objects/account.rb
95 def self.all_user_ids(refresh = false, api: nil, cnx: Jamf.cnx)
96   cnx = api if api
97   all(refresh, cnx: cnx)[:users].map { |i| i[:id] }
98 end
all_user_names(refresh = false, api: nil, cnx: Jamf.cnx) click to toggle source

@return [Array<Hash>] all JSS account user names

    # File lib/jamf/api/classic/api_objects/account.rb
101 def self.all_user_names(refresh = false, api: nil, cnx: Jamf.cnx)
102   cnx = api if api
103   all(refresh, cnx: cnx)[:users].map { |i| i[:name] }
104 end
all_users(refresh = false, api: nil, cnx: Jamf.cnx) click to toggle source

@return [Array<Hash>] all JSS account users

   # File lib/jamf/api/classic/api_objects/account.rb
89 def self.all_users(refresh = false, api: nil, cnx: Jamf.cnx)
90   cnx = api if api
91   all(refresh, cnx: cnx)[:users]
92 end
new(**args) click to toggle source

See Jamf::APIObject#initialize

Calls superclass method Jamf::APIObject::new
    # File lib/jamf/api/classic/api_objects/account.rb
160 def initialize(**args)
161   super
162 
163   # check to see if a user has been specified, haven't built groups yet
164   is_user = [:userid, :username].any? { |key| args.keys.include? key }
165 
166   return unless is_user
167 
168   @user_name = @init_data[:name]
169   @full_name = @init_data[:full_name]
170   @email = @init_data[:email]
171   @access_level = @init_data[:access_level]
172   @privilege_set = @init_data[:privilege_set]
173   @privileges = @init_data[:privileges]
174 
175 end