Merge "Use elevated context when getting default SG for tenant"

This commit is contained in:
Zuul 2021-08-09 11:49:14 +00:00 committed by Gerrit Code Review
commit 4b35811b0d
1 changed files with 4 additions and 1 deletions

View File

@ -910,8 +910,11 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase,
security_groups else [])
def _get_default_sg_id(self, context, tenant_id):
# NOTE(slaweq): With new system/project scopes it may happen that
# project admin will try to find default SG for different
# project. In such case elevated context needs to be used.
default_group = sg_obj.DefaultSecurityGroup.get_object(
context,
context.elevated(),
project_id=tenant_id,
)
if default_group: