[S-RBAC] Fix policies for l3_conntrack_helpers
Policies for those API actions should not rely on the "PROJECT_READER"
or "PROJECT_MEMBER" rules as this resource don't have project_id
attribute and instead belongs to the project of the parent resource
(which is l3_router).
This patch updates those rules to:
base.ADMIN_OR_PARENT_OWNER_MEMBER
base.ADMIN_OR_PARENT_OWNER_READER
Closes-bug: #2126759
Change-Id: Id67346262a3dbe4717273073b5f8c6a385d2180d
Signed-off-by: Slawek Kaplonski <skaplons@redhat.com>
(cherry picked from commit 0edbfe26d0)
This commit is contained in:
@@ -30,9 +30,7 @@ RESOURCE_PATH = ('/routers/{router_id}'
|
||||
rules = [
|
||||
policy.DocumentedRuleDefault(
|
||||
name='create_router_conntrack_helper',
|
||||
check_str=neutron_policy.policy_or(
|
||||
base.ADMIN_OR_PROJECT_MEMBER,
|
||||
base.PARENT_OWNER_MEMBER),
|
||||
check_str=base.ADMIN_OR_PARENT_OWNER_MEMBER,
|
||||
scope_types=['project'],
|
||||
description='Create a router conntrack helper',
|
||||
operations=[
|
||||
@@ -49,9 +47,7 @@ rules = [
|
||||
),
|
||||
policy.DocumentedRuleDefault(
|
||||
name='get_router_conntrack_helper',
|
||||
check_str=neutron_policy.policy_or(
|
||||
base.ADMIN_OR_PROJECT_READER,
|
||||
base.PARENT_OWNER_READER),
|
||||
check_str=base.ADMIN_OR_PARENT_OWNER_READER,
|
||||
scope_types=['project'],
|
||||
description='Get a router conntrack helper',
|
||||
operations=[
|
||||
@@ -72,9 +68,7 @@ rules = [
|
||||
),
|
||||
policy.DocumentedRuleDefault(
|
||||
name='update_router_conntrack_helper',
|
||||
check_str=neutron_policy.policy_or(
|
||||
base.ADMIN_OR_PROJECT_MEMBER,
|
||||
base.PARENT_OWNER_MEMBER),
|
||||
check_str=base.ADMIN_OR_PARENT_OWNER_MEMBER,
|
||||
scope_types=['project'],
|
||||
description='Update a router conntrack helper',
|
||||
operations=[
|
||||
@@ -91,9 +85,7 @@ rules = [
|
||||
),
|
||||
policy.DocumentedRuleDefault(
|
||||
name='delete_router_conntrack_helper',
|
||||
check_str=neutron_policy.policy_or(
|
||||
base.ADMIN_OR_PROJECT_MEMBER,
|
||||
base.PARENT_OWNER_MEMBER),
|
||||
check_str=base.ADMIN_OR_PARENT_OWNER_MEMBER,
|
||||
scope_types=['project'],
|
||||
description='Delete a router conntrack helper',
|
||||
operations=[
|
||||
|
||||
@@ -28,17 +28,17 @@ class L3ConntrackHelperAPITestCase(base.PolicyBaseTestCase):
|
||||
super(L3ConntrackHelperAPITestCase, self).setUp()
|
||||
self.router = {
|
||||
'id': uuidutils.generate_uuid(),
|
||||
'tenant_id': self.project_id,
|
||||
'project_id': self.project_id}
|
||||
self.alt_router = {
|
||||
'id': uuidutils.generate_uuid(),
|
||||
'tenant_id': self.alt_project_id,
|
||||
'project_id': self.alt_project_id}
|
||||
|
||||
self.target = {
|
||||
'project_id': self.project_id,
|
||||
'router_id': self.router['id'],
|
||||
'ext_parent_router_id': self.router['id']}
|
||||
self.alt_target = {
|
||||
'project_id': self.alt_project_id,
|
||||
'router_id': self.alt_router['id'],
|
||||
'ext_parent_router_id': self.alt_router['id']}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user