diff options
author | John Keiser <john@johnkeiser.com> | 2015-11-17 09:28:42 -0800 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-11-17 09:28:42 -0800 |
commit | 66a963e2d6d0865a75f7b65e26338aba6f5e52be (patch) | |
tree | 85b363ee2ea7314a71ef8917e87fc3b19897ff4b /lib/chef_zero/endpoints/principal_endpoint.rb | |
parent | 5205839b26a804ce0016c5935d11a4699d90cbda (diff) | |
parent | 0344829524c43f2872fe54f8b89198d04441b44e (diff) | |
download | chef-zero-66a963e2d6d0865a75f7b65e26338aba6f5e52be.tar.gz |
Merge branch 'cd/run-moar-pedant'
Diffstat (limited to 'lib/chef_zero/endpoints/principal_endpoint.rb')
-rw-r--r-- | lib/chef_zero/endpoints/principal_endpoint.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef_zero/endpoints/principal_endpoint.rb b/lib/chef_zero/endpoints/principal_endpoint.rb index 8cad07c..b1f4efb 100644 --- a/lib/chef_zero/endpoints/principal_endpoint.rb +++ b/lib/chef_zero/endpoints/principal_endpoint.rb @@ -8,16 +8,20 @@ module ChefZero class PrincipalEndpoint < RestBase def get(request) name = request.rest_path[-1] + # If /organizations/ORG/users/NAME exists, use this user (only org members have precedence over clients). hey are an org member. json = get_data(request, request.rest_path[0..1] + [ 'users', name ], :nil) if json type = 'user' org_member = true else + # If /organizations/ORG/clients/NAME exists, use the client. json = get_data(request, request.rest_path[0..1] + [ 'clients', name ], :nil) if json type = 'client' org_member = true else + # If there is no client with that name, check for a user (/users/NAME) and return that with + # org_member = false. json = get_data(request, [ 'users', name ], :nil) if json type = 'user' |