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)
tags/13.0.4
Slawek Kaplonski 4 months ago
parent
commit
252d80058c
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.db import utils as db_utils
24 25
 from neutron_lib import exceptions as n_exc
25 26
 from neutron_lib.utils import helpers
@@ -183,7 +184,8 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
183 184
                                                      fields)
184 185
                 if (fields is None or len(fields) == 0 or
185 186
                    'security_group_rules' in fields):
186
-                    rules = self.get_security_group_rules(context,
187
+                    rules = self.get_security_group_rules(
188
+                        context_lib.get_admin_context(),
187 189
                         {'security_group_id': [id]})
188 190
                     ret['security_group_rules'] = rules
189 191
 

Loading…
Cancel
Save