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

fix: add change permissions to the Host+ group

parent 961a7e12
No related branches found
No related tags found
No related merge requests found
Pipeline #7180 passed
...@@ -12,7 +12,7 @@ class Command(BaseCommand): ...@@ -12,7 +12,7 @@ class Command(BaseCommand):
codename__startswith="edit" codename__startswith="edit"
) )
self.stdout.write( self.stdout.write(
f" Adding app permissions to the '{program_group}' group... ", f"Adding app permissions to the '{program_group}' group... ",
ending="", ending="",
) )
self.stdout.flush() self.stdout.flush()
...@@ -24,7 +24,7 @@ class Command(BaseCommand): ...@@ -24,7 +24,7 @@ class Command(BaseCommand):
content_type__model__in=["note", "notelink"] content_type__model__in=["note", "notelink"]
).exclude(codename__startswith="edit") ).exclude(codename__startswith="edit")
self.stdout.write( self.stdout.write(
f" Adding model permissions on note & notelink to the '{host_group}' group... ", f"Adding model permissions on note & notelink to the '{host_group}' group... ",
ending="", ending="",
) )
self.stdout.flush() self.stdout.flush()
...@@ -32,11 +32,21 @@ class Command(BaseCommand): ...@@ -32,11 +32,21 @@ class Command(BaseCommand):
self.stdout.write(self.style.SUCCESS(len(model_permissions))) self.stdout.write(self.style.SUCCESS(len(model_permissions)))
host_plus_group = Group.objects.get(name=settings.ENTITLED_GROUPS[1]) host_plus_group = Group.objects.get(name=settings.ENTITLED_GROUPS[1])
change_permissions = Permission.objects.filter(
codename__startswith="change", content_type__model__in=["host", "note", "show"]
)
self.stdout.write(
f"Adding change permissions on host, note & show to the '{host_plus_group}' group... ",
ending="",
)
host_plus_group.permissions.add(*change_permissions)
self.stdout.write(self.style.SUCCESS(len(change_permissions)))
self.stdout.flush()
edit_permissions = Permission.objects.filter( edit_permissions = Permission.objects.filter(
codename__startswith="edit", content_type__model__in=["host", "note", "show"] codename__startswith="edit", content_type__model__in=["host", "note", "show"]
) )
self.stdout.write( self.stdout.write(
f" Adding edit permissions on host, note & show to the '{host_plus_group}' group... ", f"Adding edit permissions on host, note & show to the '{host_plus_group}' group... ",
ending="", ending="",
) )
self.stdout.flush() self.stdout.flush()
......
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