Skip to content

Commit 55a3543

Browse files
committed
[S-RBAC] Allow network owners to get ports from that network
It was somehow missed initially when we wrote new Secure RBAC policies but network owner should be able to see all ports created on the network. Additionally this patch adds mock of the neutron.policy.check function in TestMl2DbOperationBounds class as this class is expected to check DbOperators made by ML2 plugin while listing ports so there's no need to include policy checks there too. Conflicts: neutron/conf/policies/port.py Change-Id: I2560edb915f7393fcda50dd4a37a1d366bd0ce59
1 parent 92cfdb4 commit 55a3543

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

neutron/conf/policies/port.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@
275275
check_str=base.policy_or(
276276
base.ADMIN,
277277
base.RULE_ADVSVC,
278+
base.RULE_NET_OWNER,
278279
base.PROJECT_READER
279280
),
280281
scope_types=['project'],

neutron/tests/unit/plugins/ml2/test_plugin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,9 @@ class TestMl2DbOperationBounds(test_plugin.DbOperationBoundMixin,
903903
def setUp(self):
904904
super(TestMl2DbOperationBounds, self).setUp()
905905
self.kwargs = self.get_api_kwargs()
906+
# NOTE(slaweq): In this class we are not testing any operations related
907+
# to policy module so we don't need to checu policies
908+
mock.patch('neutron.policy.check').start()
906909

907910
def make_network(self):
908911
return self._make_network(self.fmt, 'name', True, **self.kwargs)

0 commit comments

Comments
 (0)