From d352ce40398c57fe4a2cac9fff6f96637e54b6dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Fri, 16 Sep 2022 08:55:53 -0300 Subject: [PATCH] =?UTF-8?q?Ajusta=20cria=C3=A7=C3=A3o=20de=20profile=20ape?= =?UTF-8?q?nas=20para=20users=20do=20ldap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/servidores/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sigi/apps/servidores/models.py b/sigi/apps/servidores/models.py index c01f0cb..07855e4 100644 --- a/sigi/apps/servidores/models.py +++ b/sigi/apps/servidores/models.py @@ -97,6 +97,8 @@ User.servidor = property( # baseado no nome contido no LDAP @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): + if not hasattr(instance, "ldap_user"): + return sigla_servico = instance.ldap_user.attrs.get("department", [""])[0].split( "-" )[-1]