Skip to content

Commit

Permalink
[metadata] Allow all project members to get available metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
frankrousseau committed Sep 9, 2024
1 parent 8bedda8 commit 3a753cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions zou/app/blueprints/crud/metadata_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ class MetadataDescriptorsResource(BaseModelsResource):
def __init__(self):
BaseModelsResource.__init__(self, MetadataDescriptor)

def check_read_permissions(self):
return not permissions.has_vendor_permissions()

def add_project_permission_filter(self, query):
if not permissions.has_admin_permissions():
query = query.join(Project).filter(
user_service.build_related_projects_filter()
)
return query

def all_entries(self, query=None, relations=True):
if query is None:
query = self.model.query
Expand All @@ -35,6 +45,7 @@ def check_creation_integrity(self, data):


class MetadataDescriptorResource(BaseModelResource):

def __init__(self):
BaseModelResource.__init__(self, MetadataDescriptor)

Expand Down
2 changes: 1 addition & 1 deletion zou/app/blueprints/projects/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def get(self, project_id):
200:
description: All metadata descriptors
"""
user_service.check_manager_project_access(project_id)
user_service.check_project_access(project_id)
for_client = permissions.has_client_permissions()
return projects_service.get_metadata_descriptors(
project_id, for_client
Expand Down

0 comments on commit 3a753cb

Please sign in to comment.