[sso-admin] Fix bug in user_parser

mejoras_instalacion
Evilham 2022-08-08 12:03:10 +02:00
parent 3fa0d48858
commit 519146a58f
No known key found for this signature in database
GPG Key ID: AE3EE30D970886BF
1 changed files with 3 additions and 1 deletions

View File

@ -34,7 +34,9 @@ DDUser = Dict[str, Any]
def user_parser(dduser: DDUser) -> DDUser: def user_parser(dduser: DDUser) -> DDUser:
user = copy.deepcopy(dduser) user = copy.deepcopy(dduser)
user["keycloak_id"] = user.pop("id") 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", [])) user["groups"] = user.get("groups", user.get("keycloak_groups", []))
# Compatibility for the API # Compatibility for the API
for k1, k2 in [("first", "firstname"), ("last", "lastname")]: for k1, k2 in [("first", "firstname"), ("last", "lastname")]: