Browse Source

Ajusta criação de profile apenas para users do ldap

pull/159/head
Sesostris Vieira 2 years ago
parent
commit
d352ce4039
  1. 2
      sigi/apps/servidores/models.py

2
sigi/apps/servidores/models.py

@ -97,6 +97,8 @@ User.servidor = property(
# baseado no nome contido no LDAP # baseado no nome contido no LDAP
@receiver(post_save, sender=User) @receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs): 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( sigla_servico = instance.ldap_user.attrs.get("department", [""])[0].split(
"-" "-"
)[-1] )[-1]

Loading…
Cancel
Save