Skip to content

Commit

Permalink
Merge pull request #283 from jntullo/quota_product_features
Browse files Browse the repository at this point in the history
Allow read-only access to quotas subcollection
  • Loading branch information
abellotti authored Jan 23, 2018
2 parents 99a3b63 + 53aa248 commit 9f9f4ee
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 16 additions & 1 deletion config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2852,14 +2852,29 @@
:quotas_subcollection_actions:
:get:
- :name: read
:identifier: rbac_tenant_manage_quotas
:identifier: rbac_tenant_view
:post:
- :name: create
:identifier: rbac_tenant_manage_quotas
- :name: edit
:identifier: rbac_tenant_manage_quotas
- :name: delete
:identifier: rbac_tenant_manage_quotas
:quotas_subresource_actions:
:get:
- :name: read
:identifier: rbac_tenant_view
:post:
- :name: edit
:identifier: rbac_tenant_manage_quotas
- :name: delete
:identifier: rbac_tenant_manage_quotas
:put:
- :name: edit
:identifier: rbac_tenant_manage_quotas
:delete:
- :name: delete
:identifier: rbac_tenant_manage_quotas
:users:
:description: Users
:identifier: rbac_user
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/tenant_quotas_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

context "with an appropriate role" do
it "can list all the quotas form a tenant" do
api_basic_authorize action_identifier(:quotas, :read, :subcollection_actions, :get)
api_basic_authorize subcollection_action_identifier(:tenants, :quotas, :read, :get)

quota_1 = FactoryGirl.create(:tenant_quota, :tenant_id => tenant.id, :name => :cpu_allocated, :value => 1)
quota_2 = FactoryGirl.create(:tenant_quota, :tenant_id => tenant.id, :name => :mem_allocated, :value => 20)
Expand All @@ -22,7 +22,7 @@
end

it "can show a single quota from a tenant" do
api_basic_authorize action_identifier(:quotas, :read, :subresource_actions, :get)
api_basic_authorize subcollection_action_identifier(:tenants, :quotas, :read, :get)

quota = FactoryGirl.create(:tenant_quota, :tenant_id => tenant.id, :name => :cpu_allocated, :value => 1)

Expand Down

0 comments on commit 9f9f4ee

Please sign in to comment.