diff options
author | John Keiser <jkeiser@opscode.com> | 2014-07-25 08:52:03 -0600 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2014-08-22 09:20:49 -0700 |
commit | 050901c99b325c9cb32acbd4d8517e917664100e (patch) | |
tree | 916b77f81e6f089018fe09233cbfa40148b04515 | |
parent | d03a792d33dc6ed76939398635ae54d54a0628e5 (diff) | |
download | chef-zero-050901c99b325c9cb32acbd4d8517e917664100e.tar.gz |
Fix data bags for multi-identity-key change
-rw-r--r-- | lib/chef_zero/endpoints/acl_base.rb | 5 | ||||
-rw-r--r-- | lib/chef_zero/endpoints/data_bag_endpoint.rb | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef_zero/endpoints/acl_base.rb b/lib/chef_zero/endpoints/acl_base.rb index ed30bfa..ca85590 100644 --- a/lib/chef_zero/endpoints/acl_base.rb +++ b/lib/chef_zero/endpoints/acl_base.rb @@ -16,7 +16,7 @@ module ChefZero %w(create read update delete grant).each do |perm| acls[perm] ||= {} acls[perm]['actors'] ||= begin - # The owners of the org and of the server (the superusers) have rights too + # owners = the superusers (and special case for clients owning themselves) owners ||= get_owners(path) container_acls ||= get_container_acls(request, path) if container_acls @@ -41,9 +41,8 @@ module ChefZero private def get_owners(path) - # We merge owners into every acl, because we're awesome like that. # The objects that were created with the org itself, and containers for - # some reason, have the peculiar property of missing pivotal from their acls. + # some reason, have the peculiar property of missing superusers from their acls. if is_created_with_org?(path, false) || path[0] == 'organizations' && path[2] == 'containers' owners = [] else diff --git a/lib/chef_zero/endpoints/data_bag_endpoint.rb b/lib/chef_zero/endpoints/data_bag_endpoint.rb index 9b9d5e5..ce7e263 100644 --- a/lib/chef_zero/endpoints/data_bag_endpoint.rb +++ b/lib/chef_zero/endpoints/data_bag_endpoint.rb @@ -12,7 +12,8 @@ module ChefZero end def post(request) - key = JSON.parse(request.body, :create_additions => false)[identity_key] + json = JSON.parse(request.body, :create_additions => false) + key = identity_keys.map { |k| json[k] }.select { |v| v }.first response = super(request) if response[0] == 201 already_json_response(201, DataBagItemEndpoint::populate_defaults(request, request.body, request.rest_path[3], key)) |