core: re-create anonymous user when repairing permissions

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-07-01 17:03:39 +02:00
parent eb633c607e
commit 766ceda57a
3 changed files with 2 additions and 0 deletions

View File

@ -2,6 +2,7 @@
from django.apps import apps from django.apps import apps
from django.contrib.auth.management import create_permissions from django.contrib.auth.management import create_permissions
from django.core.management.base import BaseCommand, no_translations from django.core.management.base import BaseCommand, no_translations
from guardian.management import create_anonymous_user
class Command(BaseCommand): # pragma: no cover class Command(BaseCommand): # pragma: no cover
@ -13,3 +14,4 @@ class Command(BaseCommand): # pragma: no cover
for app in apps.get_app_configs(): for app in apps.get_app_configs():
self.stdout.write(f"Checking app {app.name} ({app.label})\n") self.stdout.write(f"Checking app {app.name} ({app.label})\n")
create_permissions(app, verbosity=0) create_permissions(app, verbosity=0)
create_anonymous_user(None, using="default")