diff --git a/addressbook/api/v1/services.py b/addressbook/api/v1/services.py index b1ee1c14..24e403d4 100644 --- a/addressbook/api/v1/services.py +++ b/addressbook/api/v1/services.py @@ -69,6 +69,8 @@ def getAddressbook( "profilo", "ds_profilo", "ds_profilo_breve", + "cd_ruolo", + "ds_ruolo_locale", ).order_by("cognome", "nome") ) @@ -181,6 +183,16 @@ def getAddressbook( roles.append(d_data) + if not roles: + roles = [{"matricola": q["matricola"], + "cd_ruolo": q["cd_ruolo"], + "ds_ruolo": q["ds_ruolo_locale"], + "priorita": 1, + "cd_uo_aff_org": None, + "ds_aff_org": None, + "cd_tipo_nodo": None, + "sede": None}] + roles.sort(key=lambda x: x["priorita"]) grouped[q["id_ab"]]["Roles"] = roles final_query.append(grouped[q["id_ab"]])