Method: Chef::UserV1.list

Defined in:
lib/chef/user_v1.rb

.list(inflate = false) ⇒ Object



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/chef/user_v1.rb', line 280

def self.list(inflate = false)
  response = Chef::ServerAPI.new(Chef::Config[:chef_server_url]).get("users")
  users = if response.is_a?(Array)
            # EC 11 / CS 12 V0, V1
            #   GET /organizations/<org>/users
            transform_list_response(response)
          else
            # OSC 11
            #  GET /users
            # EC 11 / CS 12 V0, V1
            #  GET /users
            response # OSC
          end

  if inflate
    users.inject({}) do |user_map, (name, _url)|
      user_map[name] = Chef::UserV1.load(name)
      user_map
    end
  else
    users
  end
end