From 1ba5e51c41ddd478cf20217128b11f2d746292fa Mon Sep 17 00:00:00 2001 From: Evilham Date: Sat, 6 Aug 2022 21:34:41 +0200 Subject: [PATCH] bugfix in user_parser --- dd-sso/admin/src/admin/lib/callbacks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dd-sso/admin/src/admin/lib/callbacks.py b/dd-sso/admin/src/admin/lib/callbacks.py index 3298c20..5d39d4e 100644 --- a/dd-sso/admin/src/admin/lib/callbacks.py +++ b/dd-sso/admin/src/admin/lib/callbacks.py @@ -37,8 +37,9 @@ def user_parser(dduser: DDUser) -> DDUser: user["role"] = user["roles"][0] if user.get("roles", []) else None user["groups"] = user.get("groups", user.get("keycloak_groups", [])) # Compatibility for the API - user["first"] = user["firstname"] - user["last"] = user["lasttname"] + for k1, k2 in [("first", "firstname"), ("last", "lastname")]: + if k2 in user: + user[k1] = user[k2] return user