diff --git a/manila/db/sqlalchemy/api.py b/manila/db/sqlalchemy/api.py index fb62b5c7d8..1193d140a6 100644 --- a/manila/db/sqlalchemy/api.py +++ b/manila/db/sqlalchemy/api.py @@ -1851,6 +1851,12 @@ def _share_replica_get_with_filters(context, share_id=None, replica_id=None, query = model_query(context, models.ShareInstance, session=session, read_deleted="no") + if not context.is_admin: + query = query.join( + models.Share, + models.ShareInstance.share_id == models.Share.id).filter( + models.Share.project_id == context.project_id) + if share_id is not None: query = query.filter(models.ShareInstance.share_id == share_id) diff --git a/releasenotes/notes/bug-1922243-fix-project-only-replica-listing-f5f2b95ef14c3ded.yaml b/releasenotes/notes/bug-1922243-fix-project-only-replica-listing-f5f2b95ef14c3ded.yaml new file mode 100644 index 0000000000..597da61421 --- /dev/null +++ b/releasenotes/notes/bug-1922243-fix-project-only-replica-listing-f5f2b95ef14c3ded.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Fixed an issue that caused Manila to return all projects' share replicas + even when the user was not an administrator. Now, when the user is not an + administrator, only the replicas in the project perspective are going to + be displayed. For more details, please refer to + `Launchpad Bug #1922243 `_