summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Hostbase/backends.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Server/Hostbase/backends.py')
-rw-r--r--src/lib/Server/Hostbase/backends.py63
1 files changed, 31 insertions, 32 deletions
diff --git a/src/lib/Server/Hostbase/backends.py b/src/lib/Server/Hostbase/backends.py
index c59ed5e93..e6c709f35 100644
--- a/src/lib/Server/Hostbase/backends.py
+++ b/src/lib/Server/Hostbase/backends.py
@@ -1,46 +1,47 @@
from django.contrib.auth.models import User
-from ldapauth import *
+#from ldapauth import *
from nisauth import *
-class LDAPBackend(object):
+__revision__ = '$Revision$'
- def authenticate(self,username=None,password=None):
- try:
+## class LDAPBackend(object):
+
+## def authenticate(self,username=None,password=None):
+## try:
- l = ldapauth(username,password)
- temp_pass = User.objects.make_random_password(100)
- ldap_user = dict(username=l.sAMAccountName,
- )
- user_session_obj = dict(
- email=l.email,
- first_name=l.name_f,
- last_name=l.name_l,
- uid=l.badge_no
- )
- #fixme: need to add this user session obj to session
- #print str(ldap_user)
- user,created = User.objects.get_or_create(username=username)
- #print user
- #print "created " + str(created)
- return user
+## l = ldapauth(username,password)
+## temp_pass = User.objects.make_random_password(100)
+## ldap_user = dict(username=l.sAMAccountName,
+## )
+## user_session_obj = dict(
+## email=l.email,
+## first_name=l.name_f,
+## last_name=l.name_l,
+## uid=l.badge_no
+## )
+## #fixme: need to add this user session obj to session
+## #print str(ldap_user)
+## user,created = User.objects.get_or_create(username=username)
+## #print user
+## #print "created " + str(created)
+## return user
- except LDAPAUTHError,e:
- #print str(e)
- return None
+## except LDAPAUTHError,e:
+## #print str(e)
+## return None
- def get_user(self,user_id):
- try:
- return User.objects.get(pk=user_id)
- except User.DoesNotExist, e:
- print str(e)
- return None
+## def get_user(self,user_id):
+## try:
+## return User.objects.get(pk=user_id)
+## except User.DoesNotExist, e:
+## print str(e)
+## return None
class NISBackend(object):
def authenticate(self, username=None, password=None):
try:
- print "start nis authenticate"
n = nisauth(username, password)
temp_pass = User.objects.make_random_password(100)
nis_user = dict(username=username,
@@ -57,7 +58,6 @@ class NISBackend(object):
return user
except NISAUTHError, e:
- print str(e)
return None
@@ -65,6 +65,5 @@ class NISBackend(object):
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist, e:
- print str(e)
return None