Format using Black
This commit is contained in:
parent
b95662df1e
commit
2b68b55c52
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user