From 882c463e5dd3a6af5821497b84af04ce5b113e54 Mon Sep 17 00:00:00 2001 From: Diogo Silva Date: Fri, 28 Oct 2022 13:28:20 +0100 Subject: [PATCH] Simplify Expression --- src/django_keycloak/backends.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/django_keycloak/backends.py b/src/django_keycloak/backends.py index 815fcf2..f38bccb 100644 --- a/src/django_keycloak/backends.py +++ b/src/django_keycloak/backends.py @@ -62,10 +62,7 @@ def authenticate( # `create_from_token` takes cares of password hashing user = User.objects.create_from_token(token) - if token.is_superuser: - user.is_staff = user.is_superuser = True - else: - user.is_staff = user.is_superuser = False + user.is_staff = user.is_superuser = bool(token.is_superuser) user.save() return user