From 6727f39891de112560295671d75702d537b8e980 Mon Sep 17 00:00:00 2001 From: Zach Mullen Date: Thu, 14 Dec 2023 19:33:10 -0500 Subject: [PATCH] Assign t2 reviewer permission to demo user upon reset --- miqa/core/tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/miqa/core/tasks.py b/miqa/core/tasks.py index 7257ba6f..2515063e 100644 --- a/miqa/core/tasks.py +++ b/miqa/core/tasks.py @@ -12,6 +12,7 @@ import dateparser from django.conf import settings from django.contrib.auth.models import User +from guardian.shortcuts import assign_perm import pandas from rest_framework.exceptions import APIException @@ -53,13 +54,15 @@ def _download_from_s3(path: str, public: bool) -> bytes: def reset_demo(): Project.objects.all().delete() + demo_user = User.objects.get(username='test@miqa.dev') demo_project = Project( name='Demo Project', - creator=User.objects.get(username='test@miqa.dev'), + creator=demo_user, import_path='s3://miqa-storage/IXI_demo.csv', export_path='samples/demo.json', ) demo_project.save() + assign_perm('tier_2_reviewer', demo_user, demo_project) import_data(demo_project.id)