diff options
author | John Keiser <jkeiser@opscode.com> | 2014-07-24 06:42:06 -0600 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2014-08-22 09:20:48 -0700 |
commit | 9a443988b73b53238e1ad82a2d0330c72bc869f2 (patch) | |
tree | a113d407e3afa401ac388e765a78f1c23c877200 /lib | |
parent | dbb7dbdee734e0735c3a060370d26a13ce0d756d (diff) | |
download | chef-zero-9a443988b73b53238e1ad82a2d0330c72bc869f2.tar.gz |
Both organization/_acl and organizations/_acl exist
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef_zero/data_store/default_facade.rb | 20 | ||||
-rw-r--r-- | lib/chef_zero/server.rb | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/lib/chef_zero/data_store/default_facade.rb b/lib/chef_zero/data_store/default_facade.rb index fd5e7b7..a44e3e0 100644 --- a/lib/chef_zero/data_store/default_facade.rb +++ b/lib/chef_zero/data_store/default_facade.rb @@ -3,14 +3,16 @@ require 'chef_zero/data_store/interface_v2' module ChefZero module DataStore class DefaultFacade < ChefZero::DataStore::InterfaceV2 - def initialize(real_store, osc_compat) + def initialize(real_store, osc_compat, superusers = [ 'pivotal' ]) @real_store = real_store @osc_compat = osc_compat + @superusers = superusers clear end attr_reader :real_store attr_reader :osc_compat + attr_reader :superusers def default(path, name=nil) value = @defaults @@ -73,9 +75,10 @@ module ChefZero 'acls' => {} } unless osc_compat - @defaults['users'] = { - 'pivotal' => '{}' - } + @defaults['users'] = {} + superusers.each do |superuser| + @defaults['users'][superuser] = '{}' + end end end @@ -310,8 +313,15 @@ module ChefZero }, 'nodes' => {}, 'roles' => {}, + 'organization' => %'{ + "create": { "actors": #{superusers.inspect} }, + "read": { "actors": #{superusers.inspect}, "groups": [ "admins", "users" ] }, + "update": { "actors": #{superusers.inspect} }, + "delete": { "actors": #{superusers.inspect} }, + "grant": { "actors": #{superusers.inspect} } + }', 'organizations' => '{ - "read": { "groups": [ "admins", "users" ] } + "read": { "groups": [ "admins", "users" ]} }', 'sandboxes' => {} }, diff --git a/lib/chef_zero/server.rb b/lib/chef_zero/server.rb index d00613c..03d196b 100644 --- a/lib/chef_zero/server.rb +++ b/lib/chef_zero/server.rb @@ -445,8 +445,10 @@ module ChefZero [ "/organizations/*/containers/*", ContainerEndpoint.new(self) ], [ "/organizations/*/groups", GroupsEndpoint.new(self) ], [ "/organizations/*/groups/*", GroupEndpoint.new(self) ], + [ "/organizations/*/organization/_acl", AclsEndpoint.new(self) ], [ "/organizations/*/organizations/_acl", AclsEndpoint.new(self) ], [ "/organizations/*/*/*/_acl", AclsEndpoint.new(self) ], + [ "/organizations/*/organization/_acl/*", AclEndpoint.new(self) ], [ "/organizations/*/organizations/_acl/*", AclEndpoint.new(self) ], [ "/organizations/*/*/*/_acl/*", AclEndpoint.new(self) ] ] |