Some more checks on p.a.project.utils.get_admin_group_id()

This commit is contained in:
Sybren A. Stüvel 2017-05-12 13:35:50 +02:00
parent d2f548faf9
commit 7c5aef033d

View File

@ -28,8 +28,13 @@ def project_total_file_size(project_id):
def get_admin_group_id(project_id: ObjectId) -> ObjectId:
assert isinstance(project_id, ObjectId)
project = current_app.db('projects').find_one({'_id': project_id},
{'permissions': 1})
if not project:
raise ValueError(f'Project {project_id} does not exist.')
# TODO: search through all groups to find the one with the project ID as its name,
# or identify "the admin group" in a different way (for example the group with DELETE rights).
try: