From 519146a58fec445f5316a5a2a5420a87e3086cb2 Mon Sep 17 00:00:00 2001 From: Evilham Date: Mon, 8 Aug 2022 12:03:10 +0200 Subject: [PATCH] [sso-admin] Fix bug in user_parser --- dd-sso/admin/src/admin/lib/callbacks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dd-sso/admin/src/admin/lib/callbacks.py b/dd-sso/admin/src/admin/lib/callbacks.py index 5d39d4e..ca7320e 100644 --- a/dd-sso/admin/src/admin/lib/callbacks.py +++ b/dd-sso/admin/src/admin/lib/callbacks.py @@ -34,7 +34,9 @@ DDUser = Dict[str, Any] def user_parser(dduser: DDUser) -> DDUser: user = copy.deepcopy(dduser) user["keycloak_id"] = user.pop("id") - user["role"] = user["roles"][0] if user.get("roles", []) else None + if "password" in user: + user.pop("password") + user["role"] = user["roles"][0] if user.get("roles", []) else user.get("role", None) user["groups"] = user.get("groups", user.get("keycloak_groups", [])) # Compatibility for the API for k1, k2 in [("first", "firstname"), ("last", "lastname")]: