diff --git a/zou/app/blueprints/crud/metadata_descriptor.py b/zou/app/blueprints/crud/metadata_descriptor.py index 7a38947b96..652891ee2f 100644 --- a/zou/app/blueprints/crud/metadata_descriptor.py +++ b/zou/app/blueprints/crud/metadata_descriptor.py @@ -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 @@ -35,6 +45,7 @@ def check_creation_integrity(self, data): class MetadataDescriptorResource(BaseModelResource): + def __init__(self): BaseModelResource.__init__(self, MetadataDescriptor) diff --git a/zou/app/blueprints/projects/resources.py b/zou/app/blueprints/projects/resources.py index c12f4eace0..f891fd71fd 100644 --- a/zou/app/blueprints/projects/resources.py +++ b/zou/app/blueprints/projects/resources.py @@ -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