/usr/lib/ruby/vendor_ruby/chef_zero/endpoints/organization_user_endpoint.rb is in chef-zero 4.5.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | require 'ffi_yajl'
require 'chef_zero/rest_base'
module ChefZero
module Endpoints
# /organizations/ORG/users/NAME
class OrganizationUserEndpoint < RestBase
def get(request)
username = request.rest_path[3]
get_data(request) # 404 if user is not in org
user = get_data(request, [ 'users', username ])
user = FFI_Yajl::Parser.parse(user, :create_additions => false)
json_response(200, ChefData::DataNormalizer.normalize_user(user, username, ['username'], server.options[:osc_compat], request.method))
end
def delete(request)
user = get_data(request)
delete_data(request)
user = FFI_Yajl::Parser.parse(user, :create_additions => false)
json_response(200, ChefData::DataNormalizer.normalize_user(user, request.rest_path[3], ['username'], server.options[:osc_compat]))
end
# Note: post to a named org user is not permitted, alllow invalid method handling (405)
end
end
end
|