Remove role policies from policy.v3cloudsample.json

By incorporating system-scope and default roles, we've effectively
made these policies obsolete. We can simplify what we maintain and
provide a more consistent, unified view of default role behavior by
removing them.

Note that these changes are slightly different from the
policy.v3cloudsample.json role policies, hence the removed tests. In
policy.v3cloudsample.json, domain users were allowed to get and list
global roles. So were project users. This behavior is changing because
global roles are considered global resources of the deployment, and
they should be managed by system users. Domain users should be able to
add and remove domain specific roles, which will come in a subsequent
series of patches. This approach is being taken because it is a safer
default for a system level resource (global roles) and still allows
the same functionality for domain users through domain-specific roles.

Change-Id: Iddaa59024a1dcefd4d791b95413602865888c1ff
Closes-Bug: 1806713
This commit is contained in:
Lance Bragstad 2018-12-04 18:23:36 +00:00
parent 512f0b4f7b
commit 6d756ad612
4 changed files with 21 additions and 28 deletions

View File

@ -76,12 +76,6 @@
"identity:ec2_create_credential": "rule:admin_required or rule:owner", "identity:ec2_create_credential": "rule:admin_required or rule:owner",
"identity:ec2_delete_credential": "rule:admin_required or (rule:owner and user_id:%(target.credential.user_id)s)", "identity:ec2_delete_credential": "rule:admin_required or (rule:owner and user_id:%(target.credential.user_id)s)",
"identity:get_role": "rule:admin_required",
"identity:list_roles": "rule:admin_required",
"identity:create_role": "rule:cloud_admin",
"identity:update_role": "rule:cloud_admin",
"identity:delete_role": "rule:cloud_admin",
"identity:get_domain_role": "rule:cloud_admin or rule:get_domain_roles", "identity:get_domain_role": "rule:cloud_admin or rule:get_domain_roles",
"identity:list_domain_roles": "rule:cloud_admin or rule:list_domain_roles", "identity:list_domain_roles": "rule:cloud_admin or rule:list_domain_roles",
"identity:create_domain_role": "rule:cloud_admin or rule:domain_admin_matches_domain_role", "identity:create_domain_role": "rule:cloud_admin or rule:domain_admin_matches_domain_role",

View File

@ -196,6 +196,11 @@ class PolicyJsonTestCase(unit.TestCase):
'identity:list_service_providers', 'identity:list_service_providers',
'identity:update_service_provider', 'identity:update_service_provider',
'identity:delete_service_provider', 'identity:delete_service_provider',
'identity:create_role',
'identity:get_role',
'identity:list_roles',
'identity:update_role',
'identity:delete_role',
'identity:create_region', 'identity:create_region',
'identity:get_region', 'identity:get_region',
'identity:list_regions', 'identity:list_regions',

View File

@ -1867,28 +1867,6 @@ class IdentityTestv3CloudPolicySample(test_v3.RestfulTestCase,
self._role_management_cases(expected=exception.ForbiddenAction.code) self._role_management_cases(expected=exception.ForbiddenAction.code)
def test_role_management_with_project_admin(self):
# A project admin user should be able to get and list, but not be able
# to create/update/delete global roles
self.auth = self.build_authentication_request(
user_id=self.project_admin_user['id'],
password=self.project_admin_user['password'],
project_id=self.project['id'])
self._role_management_cases(read_status_OK=True,
expected=exception.ForbiddenAction.code)
def test_role_management_with_domain_admin(self):
# A domain admin user should be able to get and list, but not be able
# to create/update/delete global roles
self.auth = self.build_authentication_request(
user_id=self.domain_admin_user['id'],
password=self.domain_admin_user['password'],
domain_id=self.domainA['id'])
self._role_management_cases(read_status_OK=True,
expected=exception.ForbiddenAction.code)
def test_role_management_with_cloud_admin(self): def test_role_management_with_cloud_admin(self):
# A cloud admin user should have rights to manipulate global roles # A cloud admin user should have rights to manipulate global roles
self.auth = self.build_authentication_request( self.auth = self.build_authentication_request(

View File

@ -0,0 +1,16 @@
---
upgrade:
- |
[`bug 1806713 <https://bugs.launchpad.net/keystone/+bug/1806713>`_]
The role policies defined in ``policy.v3cloudsample.json`` have
been removed. These policies are now obsolete after incorporating
system-scope into the role API and implementing default roles.
fixes:
- |
[`bug 1806713 <https://bugs.launchpad.net/keystone/+bug/1806713>`_]
The role policies in ``policy.v3cloudsample.json`` policy file
have been removed in favor of better defaults in code. These
policies weren't tested exhaustively and were misleading to users
and operators.