Skip to content

Commit

Permalink
🐛 [#597] Add co-reviewer permission to Administrator group
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm authored and svenvandescheur committed Jan 9, 2025
1 parent 8765865 commit 34af00c
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 4.2.16 on 2025-01-09 11:05

from django.db import migrations


def add_co_reviewer_permission_to_admin_group(apps, schema_editor):
Group = apps.get_model("auth", "Group")
Permission = apps.get_model("auth", "Permission")

User = apps.get_model("accounts", "User")
ContentType = apps.get_model("contenttypes", "ContentType")

can_co_review, _ = Permission.objects.get_or_create(
codename="can_co_review_destruction",
name="Can co-review destruction",
content_type=ContentType.objects.get_for_model(User),
)

admin_group, _ = Group.objects.get_or_create(name="Administrator")
admin_group.permissions.add(can_co_review)


class Migration(migrations.Migration):

dependencies = [
("accounts", "0008_add_co_reviewer_group"),
]

operations = [
migrations.RunPython(
add_co_reviewer_permission_to_admin_group, migrations.RunPython.noop
)
]

0 comments on commit 34af00c

Please sign in to comment.