Fix Share Network Subnet Metadata policy error

When the user logged is not an admin, the project find for the
policies using some information like project_id. Since the
Subnet model doesn't have project_id, the new property refering
the Share Network project_id now is used to guarantee access

Closes-bug: #2011869
Change-Id: I58331fa6906c855804abb94fad85a8370625c886
This commit is contained in:
renanpiranguinho 2023-03-13 13:34:11 +00:00
parent f03e84ae62
commit 1a603682ae
2 changed files with 10 additions and 0 deletions

View File

@ -1066,6 +1066,10 @@ class ShareNetworkSubnet(BASE, ManilaBase):
metadata_dict[meta['key']] = meta['value']
return metadata_dict
@property
def project_id(self):
return self.share_network['project_id']
class ShareNetworkSubnetMetadata(BASE, ManilaBase):
"""Represents a metadata key/value pair for a subnet."""

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Share Network Subnet Metadata now can be add by any user, as the
project_id used to verify the policy in the case of a non-admin user
now is present in the Share Network Subnet db model.