Browse Source

Show all SG rules belong to SG in group's details

If security group contains rule(s) which were created by different
user (admin), owner of this security group should see such rules
even if those rules don't belong to him.

This patch changes to use admin_context to get security group rules
in get_security_group() method to achieve that.

Test to cover such case is added in neutron-tempest-plugin repo.

Conflicts:
    neutron/db/securitygroups_db.py

Change-Id: I890c81bb6eabc5caa620ed4fcc4dc88ebfa6e1b0
Closes-Bug: #1824248
(cherry picked from commit 1920a37a94)
(cherry picked from commit 252d80058c)
tags/12.1.0
Slawek Kaplonski 4 months ago
parent
commit
e02b66a858
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      neutron/db/securitygroups_db.py

+ 3
- 1
neutron/db/securitygroups_db.py View File

@@ -20,6 +20,7 @@ from neutron_lib.callbacks import exceptions
20 20
 from neutron_lib.callbacks import registry
21 21
 from neutron_lib.callbacks import resources
22 22
 from neutron_lib import constants
23
+from neutron_lib import context as context_lib
23 24
 from neutron_lib import exceptions as n_exc
24 25
 from neutron_lib.utils import helpers
25 26
 from neutron_lib.utils import net
@@ -189,7 +190,8 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
189 190
                                                      fields)
190 191
                 if (fields is None or len(fields) == 0 or
191 192
                    'security_group_rules' in fields):
192
-                    rules = self.get_security_group_rules(context,
193
+                    rules = self.get_security_group_rules(
194
+                        context_lib.get_admin_context(),
193 195
                         {'security_group_id': [id]})
194 196
                     ret['security_group_rules'] = rules
195 197
 

Loading…
Cancel
Save