|
Lines 124-130
import univention.admin.uexceptions as udm_errors
Link Here
|
| 124 |
|
124 |
|
| 125 |
from univention.management.console.protocol.message import Response, MIMETYPE_JSON |
125 |
from univention.management.console.protocol.message import Response, MIMETYPE_JSON |
| 126 |
from univention.management.console.protocol.definitions import MODULE_ERR, MODULE_ERR_COMMAND_FAILED, SUCCESS |
126 |
from univention.management.console.protocol.definitions import MODULE_ERR, MODULE_ERR_COMMAND_FAILED, SUCCESS |
| 127 |
from univention.management.console.ldap import get_user_connection, reset_cache as reset_ldap_connection_cache |
127 |
from univention.management.console.ldap import get_user_connection, reset_cache as reset_ldap_connection_cache, cleanup_connection |
| 128 |
from univention.management.console.config import ucr |
128 |
from univention.management.console.config import ucr |
| 129 |
from univention.management.console.log import MODULE, CORE |
129 |
from univention.management.console.log import MODULE, CORE |
| 130 |
from univention.management.console.error import UMC_Error, NotAcceptable, PasswordRequired, LDAP_ServerDown, LDAP_ConnectionFailed, Unauthorized |
130 |
from univention.management.console.error import UMC_Error, NotAcceptable, PasswordRequired, LDAP_ServerDown, LDAP_ConnectionFailed, Unauthorized |
|
Lines 161-166
class Base(signals.Provider, Translation):
Link Here
|
| 161 |
self.__acls = None |
161 |
self.__acls = None |
| 162 |
self.__current_language = None |
162 |
self.__current_language = None |
| 163 |
self.__requests = {} |
163 |
self.__requests = {} |
|
|
164 |
self.__user_connections = set() |
| 164 |
Translation.__init__(self, domain) |
165 |
Translation.__init__(self, domain) |
| 165 |
|
166 |
|
| 166 |
def update_language(self, locales): |
167 |
def update_language(self, locales): |
|
Lines 400-405
class Base(signals.Provider, Translation):
Link Here
|
| 400 |
return # local user (probably root) |
401 |
return # local user (probably root) |
| 401 |
try: |
402 |
try: |
| 402 |
lo, po = get_user_connection(bind=self.bind_user_connection, write=False, follow_referral=True) |
403 |
lo, po = get_user_connection(bind=self.bind_user_connection, write=False, follow_referral=True) |
|
|
404 |
self.__user_connections.add(lo) |
| 403 |
return lo |
405 |
return lo |
| 404 |
except (ldap.LDAPError, udm_errors.base) as exc: |
406 |
except (ldap.LDAPError, udm_errors.base) as exc: |
| 405 |
CORE.warn('Failed to open LDAP connection for user %s: %s' % (self._user_dn, exc)) |
407 |
CORE.warn('Failed to open LDAP connection for user %s: %s' % (self._user_dn, exc)) |
|
Lines 487-489
class Base(signals.Provider, Translation):
Link Here
|
| 487 |
if response.id in self.__requests: |
489 |
if response.id in self.__requests: |
| 488 |
self.signal_emit('success', response) |
490 |
self.signal_emit('success', response) |
| 489 |
del self.__requests[response.id] |
491 |
del self.__requests[response.id] |
|
|
492 |
|
| 493 |
def __del__(self): |
| 494 |
for lo in self.__user_connections: |
| 495 |
cleanup_connection(lo) |