diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-06-01 14:29:10 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-06-01 14:29:10 +0100 |
commit | f5cda7311f42b9ec9f4627121421b46b55e8346c (patch) | |
tree | 07615ffe6af0d1b995b9db436667fb1afc65fd92 /ctrack/core | |
parent | 4b1016247bc0b8f1c4d33b5a471b6f65a5b787b4 (diff) |
added missing persmissions for views
Diffstat (limited to 'ctrack/core')
-rw-r--r-- | ctrack/core/utils.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/ctrack/core/utils.py b/ctrack/core/utils.py index ef998d0..fb49235 100644 --- a/ctrack/core/utils.py +++ b/ctrack/core/utils.py @@ -2,7 +2,8 @@ import random from random import choice, randint from django.contrib.auth import get_user_model -from django.contrib.auth.models import Group +from django.contrib.auth.models import Group, Permission +from django.db.models import Q from faker import Faker from ctrack.assessments.models import ( @@ -73,6 +74,32 @@ def populate_db(**kwargs): # Groups cct_staff_group = Group.objects.create(name="cct_users") + ctrack_permissions = Permission.objects.filter( + Q(codename__contains="address") + | Q(codename__contains="addresstype") + | Q(codename__contains="mode") + | Q(codename__contains="organisation") + | Q(codename__contains="role") + | Q(codename__contains="submode") + | Q(codename__contains="person") + | Q(codename__contains="applicablesystem") + | Q(codename__contains="caf") + | Q(codename__contains="documentfile") + | Q(codename__contains="filestore") + | Q(codename__contains="grading") + | Q(codename__contains="engagementtype") + | Q(codename__contains="engagementevent") + | Q(codename__contains="cafassessment") + | Q(codename__contains="cafobjective") + | Q(codename__contains="cafprinciple") + | Q(codename__contains="cafcontributingoutcome") + | Q(codename__contains="cafassessmentoutcomescore") + | Q(codename__contains="achievmentlevel") + | Q(codename__contains="igp") + | Q(codename__contains="stakeholder") + | Q(codename__contains="incidentreport") + ) + cct_staff_group.permissions.add(*ctrack_permissions) # Set up some reasonable Modes and SubModes m1 = Mode.objects.create(descriptor="Rail") |