1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-07-07 20:15:42 +00:00

Check for ldap3 existence

This commit is contained in:
Kendar 2021-05-28 12:55:47 +02:00
parent 881852af05
commit b761faccec

View file

@ -1,12 +1,13 @@
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from ldap3 import Server, Connection, ALL
from django.conf import settings
from accounts.models import UserAttributes, UserInstance, UserSSHKey
from django.contrib.auth.models import Permission
from logs.models import Logs
import uuid
try:
from ldap3 import Server, Connection, ALL
#/srv/webvirtcloud/ldap/ldapbackend.py
class LdapAuthenticationBackend(ModelBackend):
@ -107,3 +108,9 @@ class LdapAuthenticationBackend(ModelBackend):
except User.DoesNotExist:
print("get_user-user not found")
return None
except:
class LdapAuthenticationBackend(ModelBackend):
def authenticate(self, request, username=None, password=None, **kwargs):
return None
def get_user(self, user_id):
return None