Skip to content

Commit

Permalink
Fix Share Network Subnet Metadata policy error
Browse files Browse the repository at this point in the history
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
(cherry picked from commit 1a60368)
  • Loading branch information
renanpiranguinho authored and gouthampacha committed May 4, 2023
1 parent 6d81359 commit 712202d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions manila/db/sqlalchemy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,10 @@ def subnet_metadata(self):
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."""
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 712202d

Please sign in to comment.