Skip to content

Commit

Permalink
Update apps.py
Browse files Browse the repository at this point in the history
update builtin roles during migration to facilitate migrations.
  • Loading branch information
eric-intuitem committed Feb 23, 2024
1 parent 58a6702 commit c8ee3c8
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions backend/core/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,17 @@ def startup(**kwargs):
Folder.objects.create(
name="Global", content_type=Folder.ContentType.ROOT, builtin=True
)
auditor = Role.objects.create(name="BI-RL-AUD", builtin=True)
auditor.permissions.set(auditor_permissions)
approver = Role.objects.create(name="BI-RL-VAL", builtin=True)
approver.permissions.set(approver_permissions)
analyst = Role.objects.create(name="BI-RL-ANA", builtin=True)
analyst.permissions.set(analyst_permissions)
domain_manager = Role.objects.create(name="BI-RL-DMA", builtin=True)
domain_manager.permissions.set(domain_manager_permissions)
administrator = Role.objects.create(name="BI-RL-ADM", builtin=True)
administrator.permissions.set(administrator_permissions)
# update builtin roles to facilitate migrations
auditor, created = Role.objects.get_or_create(name="BI-RL-AUD", builtin=True)
auditor.permissions.set(auditor_permissions)
approver, created = Role.objects.get_or_create(name="BI-RL-VAL", builtin=True)
approver.permissions.set(approver_permissions)
analyst, created = Role.objects.get_or_create(name="BI-RL-ANA", builtin=True)
analyst.permissions.set(analyst_permissions)
domain_manager, created = Role.objects.get_or_create(name="BI-RL-DMA", builtin=True)
domain_manager.permissions.set(domain_manager_permissions)
administrator, created = Role.objects.get_or_create(name="BI-RL-ADM", builtin=True)
administrator.permissions.set(administrator_permissions)
# if global administrators user group does not exist, then create it
if not UserGroup.objects.filter(
name="BI-UG-ADM", folder=Folder.get_root_folder()
Expand Down

0 comments on commit c8ee3c8

Please sign in to comment.