Skip to content
Snippets Groups Projects
Commit dab03856 authored by Adam Fekete's avatar Adam Fekete
Browse files

Merge branch 'fix-coauthor-groups-north-access' into 'develop'

Fix access to NORTH tool for coauthor groups

Closes #2176

See merge request !2172
parents 505bb2d7 183c3458
No related branches found
No related tags found
1 merge request!2172Fix access to NORTH tool for coauthor groups
Pipeline #224333 passed
......@@ -21,6 +21,7 @@ import requests
from typing import List, Dict, Optional
from enum import Enum
from nomad.groups import get_group_ids
from pydantic import BaseModel
from fastapi import APIRouter, Depends, status, HTTPException
from mongoengine.queryset.visitor import Q
......@@ -187,8 +188,14 @@ async def start_tool(
upload_mount_dir = None
user_id = str(user.user_id)
group_ids = get_group_ids(user.user_id, include_all=False)
upload_query = Q()
upload_query &= Q(main_author=user_id) | Q(coauthors=user_id)
upload_query &= (
Q(main_author=user_id)
| Q(coauthors=user.user_id)
| Q(coauthor_groups__in=group_ids)
)
upload_query &= Q(publish_time=None)
uploads: List[Dict] = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment