Skip to content

Commit 876c681

Browse files
committed
[S-RBAC] Get availability zone API available for READER role
API call get_availability_zone 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). Closes-bug: #2016266 Change-Id: I8a99bc52bd815fb3395e902fc8f85cf5f187e288 (cherry picked from commit 6b5acb5)
1 parent fbb96b9 commit 876c681

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

neutron/conf/policies/availability_zone.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
rules = [
2323
policy.DocumentedRuleDefault(
2424
name='get_availability_zone',
25-
check_str=base.ADMIN,
25+
# NOTE: it can't be ADMIN_OR_PROJECT_READER constant from the base
26+
# module because that is using "project_id" in the check string and the
27+
# availability_zone resource don't belongs to any project thus such
28+
# check string would fail enforcement.
29+
check_str='role:reader',
2630
description='List availability zones',
2731
operations=[
2832
{

neutron/tests/unit/conf/policies/test_availability_zone.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ def setUp(self):
7070
super(ProjectMemberTests, self).setUp()
7171
self.context = self.project_member_ctx
7272

73-
def test_get_availability_zone(self):
74-
self.assertRaises(
75-
base_policy.PolicyNotAuthorized,
76-
policy.enforce,
77-
self.context, "get_availability_zone", self.target)
78-
7973

8074
class ProjectReaderTests(ProjectMemberTests):
8175

0 commit comments

Comments
 (0)