Format using Black

This commit is contained in:
PapaTutuWawa 2021-02-05 17:00:55 +01:00
parent b95662df1e
commit 2b68b55c52

View File

@ -13,6 +13,7 @@ import ldap
User = get_typed_user_model()
def ldap_setting(name, default):
"""Wrapper around django.conf.settings"""
return getattr(settings, f"LDAP_{name}", default)
@ -78,10 +79,12 @@ class LDAPConnection:
return True
return False
def is_user_in_ldap(user: UserType = Depends(get_authenticated_user)):
if not LDAPConnection.get_instance().has_user(user.username):
raise PermissionDenied(detail="User not in LDAP directory.")
def create_user(context: CallbackContext, *args, **kwargs):
"""
A create_user function which first checks if the user already exists in the