-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #664 from OpenImaging/demo-user-perms
Assign t2 reviewer permission to demo user upon reset
- Loading branch information
Showing
1 changed file
with
4 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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='[email protected]') | ||
demo_project = Project( | ||
name='Demo Project', | ||
creator=User.objects.get(username='[email protected]'), | ||
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) | ||
|
||
|