Skip to content
Snippets Groups Projects
Verified Commit 8ab571c9 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

Revert "feat: add permissions to the new groups"

This reverts commit 77bfa13b.
parent 20578d3d
No related branches found
No related tags found
Loading
# Generated by Django 4.2.6 on 2023-12-11 20:28
from django.db import migrations
def add_permissions_to_groups(apps, _):
ContentType = apps.get_model("contenttypes", "ContentType")
Group = apps.get_model("auth", "Group")
Permission = apps.get_model("auth", "Permission")
Note = apps.get_model("program", "Note")
NoteLink = apps.get_model("program", "NoteLink")
program = Group.objects.get(name="Program")
for permission in Permission.objects.filter(content_type__app_label="program"):
program.permissions.add(permission)
broadcast = Group.objects.get(name="Broadcast")
for permission in Permission.objects.filter(
content_type__in=[
ContentType.objects.get_for_model(Note),
ContentType.objects.get_for_model(NoteLink),
]
):
broadcast.permissions.add(permission)
broadcast_plus = Group.objects.get(name="BroadcastPlus")
for permission in Permission.objects.filter(
codename__in=[
# for `Host`
"change_biography",
"change_email",
"change_image",
"change_name",
# for `Show`
"change_description",
"change_email",
"change_image",
"change_logo",
"change_name",
"change_short_description",
]
):
broadcast_plus.permissions.add(permission)
class Migration(migrations.Migration):
dependencies = [
("program", "0076_add_permissions_and_groups"),
]
operations = [migrations.RunPython(code=add_permissions_to_groups)]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment