diff --git a/sapl/legacy/migration.py b/sapl/legacy/migration.py index 8cb9bb37d..7794ca273 100644 --- a/sapl/legacy/migration.py +++ b/sapl/legacy/migration.py @@ -8,6 +8,7 @@ import yaml from django.apps import apps from django.apps.config import AppConfig from django.contrib.auth import get_user_model +from django.contrib.auth.models import Group from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.db import OperationalError, ProgrammingError, connections, models @@ -755,6 +756,13 @@ def adjust_autor(new, old): with reversion.create_revision(): user.save() reversion.set_comment('Objeto criado pela migração') + + grupo_autor = Group.objects.get(name="Autor") + user.groups.add(grupo_autor) + if old.cod_parlamentar: + grupo_parlamentar = Group.objects.get(name="Parlamentar") + user.groups.add(grupo_parlamentar) + new.user = user else: new.user = get_user_model().objects.filter(