Skip to content

Commit

Permalink
[S-RBAC] Get QoS rule types API available for READER role
Browse files Browse the repository at this point in the history
API call "get_rule_types" should be available in new policies for
all users with READER role as this is kind of the same what was in the
old policies (ANY).

Depends-On: https://review.opendev.org/c/openstack/neutron-tempest-plugin/+/882818

Closes-Bug: #2018585
Change-Id: I8281bd8a902bcaba1187565e9610d598e4ebc254
(cherry picked from commit 01de74d)
(cherry picked from commit c82eee0)
  • Loading branch information
ralonsoh committed May 10, 2023
1 parent 9177e90 commit ca942e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 5 additions & 1 deletion neutron/conf/policies/qos.py
Expand Up @@ -103,7 +103,11 @@

policy.DocumentedRuleDefault(
name='get_rule_type',
check_str=base.ADMIN,
# NOTE(ralonsoh): it can't be ADMIN_OR_PROJECT_READER constant from the
# base module because that is using "project_id" in the check string
# and the rule type resource don't belongs to any project thus such
# check string would fail enforcement.
check_str='role:reader',
scope_types=['project'],
description='Get available QoS rule types',
operations=[
Expand Down
6 changes: 0 additions & 6 deletions neutron/tests/unit/conf/policies/test_qos.py
Expand Up @@ -210,12 +210,6 @@ def setUp(self):
super(ProjectMemberQosRuleTypeTests, self).setUp()
self.context = self.project_member_ctx

def test_get_rule_type(self):
self.assertRaises(
base_policy.PolicyNotAuthorized,
policy.enforce,
self.context, 'get_rule_type', self.target)


class ProjectReaderQosRuleTypeTests(ProjectMemberQosRuleTypeTests):

Expand Down

0 comments on commit ca942e9

Please sign in to comment.