summaryrefslogtreecommitdiff
path: root/nova/tests/unit/policy_fixture.py
diff options
context:
space:
mode:
authorPrashanth kumar reddy <prashkre@in.ibm.com>2016-10-27 07:09:01 -0400
committerMatthew Edmonds <edmondsw@us.ibm.com>2016-11-21 11:43:13 -0500
commit4a09c2210b3c07343411a06c676c2d85aa0e214f (patch)
tree88b774634beeaf3b6256f38234c42314892f4c69 /nova/tests/unit/policy_fixture.py
parenta58c7e5173103755f5a60f0a3ecede77e662ada3 (diff)
downloadnova-4a09c2210b3c07343411a06c676c2d85aa0e214f.tar.gz
Separate CRUD policy for server_groups
The same policy rule (os_compute_api:os-server-groups) is being used for all actions (show, index, delete, create) for server_groups REST APIs. It is thus impossible to provide different RBAC for specific actions based on roles. To address this changes are made to have separate policy rules for each of action. It has been argued that index and show may not need separate policy rules, but most other places in nova (and OpenStack in general) do have separate policy rules for each action. This affords the ultimate flexibility to deployers, who can obviously use the same rule if that is what they want. One example where show and index may be different is that if show is restricted based on some criteria, such that a user is able to see some resources within the tenant but not others, then list would need to be disallowed to prevent the user from using list to see resources they cannot show. Change-Id: Ica9e07f6e80257902b4a0cc44b65fd6bad008bba Closes-Bug: #1636157
Diffstat (limited to 'nova/tests/unit/policy_fixture.py')
-rw-r--r--nova/tests/unit/policy_fixture.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/nova/tests/unit/policy_fixture.py b/nova/tests/unit/policy_fixture.py
index b112ac1a9e..5f917ac607 100644
--- a/nova/tests/unit/policy_fixture.py
+++ b/nova/tests/unit/policy_fixture.py
@@ -54,9 +54,10 @@ class RealPolicyFixture(fixtures.Fixture):
nova.policy.init()
self.addCleanup(nova.policy.reset)
- def set_rules(self, rules):
+ def set_rules(self, rules, overwrite=True):
policy = nova.policy._ENFORCER
- policy.set_rules(oslo_policy.Rules.from_dict(rules))
+ policy.set_rules(oslo_policy.Rules.from_dict(rules),
+ overwrite=overwrite)
def add_missing_default_rules(self, rules):
"""Adds default rules and their values to the given rules dict.