1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-10-07 15:33:51 +03:00

6 Commits

Author SHA1 Message Date
Adolfo Gómez García
3372de7b6c fixed worker bug 2014-11-22 10:46:17 +01:00
Adolfo Gómez García
0932865215 fixed worker bug 2014-11-22 10:41:35 +01:00
Adolfo Gómez García
3c91f6e62b Fixed Assigned an unussed checker bug 2014-11-22 10:39:57 +01:00
Adolfo Gómez García
5261bff8ae fixed login requests without locale 2014-10-16 05:21:52 +02:00
Adolfo Gómez García
20c5266829 Fixed LDAP Authenticator (unicode related issue) 2014-09-11 14:32:18 +02:00
Adolfo Gómez García
90d13c27d8 updated .gitignore 2014-09-08 13:21:45 +02:00
4 changed files with 14 additions and 7 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,7 @@
*.pyc
*.orig
.coverage
# Debian buildings
*.debhelper*

View File

@@ -114,7 +114,9 @@ class Dispatcher(View):
handler = cls(request, full_path, http_method, processor.processParameters(), *args, **kwargs)
# If no lang on request, try to get the one from
if lang is None:
activate(handler.getValue('locale'))
lang = handler.getValue('locale')
lang = lang if lang is not None else 'en'
activate(lang)
else:
handler.setValue('locale', lang) # Update Locale if request had one

View File

@@ -33,6 +33,8 @@
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''
from __future__ import unicode_literals
from django.utils.translation import ugettext_noop as _
from uds.core.ui.UserInterface import gui
from uds.core.auths import Authenticator
@@ -41,7 +43,7 @@ from uds.core.auths.Exceptions import AuthenticatorException
import ldap
import logging
__updated__ = '2014-03-19'
__updated__ = '2014-09-11'
logger = logging.getLogger(__name__)
@@ -177,7 +179,7 @@ class SimpleLDAPAuthenticator(Authenticator):
try:
con = self.__connection()
filter_ = '(&(objectClass=%s)(%s=%s))' % (self._userClass, self._userIdAttr, username)
attrlist = self._userNameAttr.split(',') + [self._userIdAttr]
attrlist = [i.encode('utf-8') for i in self._userNameAttr.split(',') + [self._userIdAttr]]
logger.debug('Getuser filter_: {0}, attr list: {1}'.format(filter_, attrlist))
res = con.search_ext_s(base=self._ldapBase, scope=ldap.SCOPE_SUBTREE,
filterstr=filter_, attrlist=attrlist, sizelimit=LDAP_RESULT_LIMIT)[0]
@@ -194,7 +196,7 @@ class SimpleLDAPAuthenticator(Authenticator):
try:
con = self.__connection()
filter_ = '(&(objectClass=%s)(%s=%s))' % (self._groupClass, self._groupIdAttr, groupName)
attrlist = [self._memberAttr]
attrlist = [self._memberAttr.encode('utf-8')]
logger.debug('Getgroup filter_: {0}, attr list {1}'.format(filter_, attrlist))
res = con.search_ext_s(base=self._ldapBase, scope=ldap.SCOPE_SUBTREE,
filterstr=filter_, attrlist=attrlist, sizelimit=LDAP_RESULT_LIMIT)[0]
@@ -410,7 +412,7 @@ class SimpleLDAPAuthenticator(Authenticator):
# And group part, with membership
try:
res = con.search_ext_s(base=self._ldapBase, scope=ldap.SCOPE_SUBTREE, filterstr='(&(objectClass=%s)(%s=*))' % (self._groupClass, self._groupIdAttr), attrlist=[self._memberAttr])
res = con.search_ext_s(base=self._ldapBase, scope=ldap.SCOPE_SUBTREE, filterstr='(&(objectClass=%s)(%s=*))' % (self._groupClass, self._groupIdAttr), attrlist=[self._memberAttr.encode('utf-8')])
if len(res) == 0:
raise Exception(_('Ldap group class or group id attr is probably wrong (can\'t find any group with both conditions)'))
ok = False

View File

@@ -59,11 +59,11 @@ class AssignedAndUnused(Job):
osm = ds.osmanager.getInstance()
if osm.processUnusedMachines is True:
logger.debug('Processing unused services for {0}'.format(osm))
for us in ds.assignedUserServices().select().filter(in_use=False, state_date__lt=since_state, state=State.USABLE, os_state=State.USABLE):
for us in ds.assignedUserServices().filter(in_use=False, state_date__lt=since_state, state=State.USABLE, os_state=State.USABLE):
logger.debug('Found unused assigned service {0}'.format(us))
osm.processUnused(us)
else: # No os manager, simply remove unused services in specified time
with transaction.atomic():
for us in ds.assignedUserServices().select().filter(in_use=False, state_date__lt=since_state, state=State.USABLE, os_state=State.USABLE):
for us in ds.assignedUserServices().filter(in_use=False, state_date__lt=since_state, state=State.USABLE, os_state=State.USABLE):
logger.debug('Found unused assigned service {0}'.format(us))
us.remove()