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.

Change-Id: I890c81bb6eabc5caa620ed4fcc4dc88ebfa6e1b0
Closes-Bug: #1824248
changes/74/660174/1
Slawek Kaplonski 4 months ago
parent
commit
1920a37a94
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 api as db_api
24 25
 from neutron_lib.db import model_query
25 26
 from neutron_lib.db import resource_extend
@@ -190,7 +191,8 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase,
190 191
                 if (fields is None or len(fields) == 0 or
191 192
                    'security_group_rules' in fields):
192 193
                     rules = self.get_security_group_rules(
193
-                        context, {'security_group_id': [id]})
194
+                        context_lib.get_admin_context(),
195
+                        {'security_group_id': [id]})
194 196
                     ret['security_group_rules'] = rules
195 197
 
196 198
         finally:

Loading…
Cancel
Save