mirror of
https://github.com/retspen/webvirtcloud
synced 2026-07-08 04:25:42 +00:00
Check for ldap3 existence
This commit is contained in:
parent
881852af05
commit
b761faccec
1 changed files with 105 additions and 98 deletions
|
|
@ -1,14 +1,15 @@
|
|||
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
|
||||
|
||||
#/srv/webvirtcloud/ldap/ldapbackend.py
|
||||
class LdapAuthenticationBackend(ModelBackend):
|
||||
try:
|
||||
from ldap3 import Server, Connection, ALL
|
||||
#/srv/webvirtcloud/ldap/ldapbackend.py
|
||||
class LdapAuthenticationBackend(ModelBackend):
|
||||
|
||||
def get_LDAP_user(self, username, password, filterString):
|
||||
print('get_LDAP_user')
|
||||
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue