View | Details | Raw Unified | Return to bug 42423
Collapse All | Expand All

(-)a/management/univention-management-console-module-udm/umc/python/udm/udm_ldap.py (-24 / +5 lines)
 Lines 56-61    Link Here 
56
56
57
from ldap import LDAPError, NO_SUCH_OBJECT
57
from ldap import LDAPError, NO_SUCH_OBJECT
58
from ldap.filter import filter_format
58
from ldap.filter import filter_format
59
from ldap.dn import explode_dn
59
60
60
try:
61
try:
61
	import univention.admin.license
62
	import univention.admin.license
 Lines 985-1015   def ldap_dn2path(ldap_dn, include_rdn=True): Link Here 
985
	representation"""
986
	representation"""
986
987
987
	ldap_base = ucr.get('ldap/base')
988
	ldap_base = ucr.get('ldap/base')
988
	if ldap_base is None or not ldap_dn.endswith(ldap_base):
989
	if not ldap_base or not ldap_dn.lower().endswith(ldap_base.lower()):
989
		return ldap_dn
990
		return ldap_dn
990
	rel_path = ldap_dn[: -1 * len(ldap_base)]
991
	rel_path = ldap_dn[:-(1 + len(ldap_base))]
991
	path = []
992
	rel_path = explode_dn(rel_path, True)[int(not include_rdn):]
992
	for item in ldap_base.split(','):
993
	return '%s:/%s' % ('.'.join(reversed(explode_dn(ldap_base, True))), '/'.join(reversed(rel_path)))
993
		if not item:
994
			continue
995
		dummy, value = item.split('=', 1)
996
		path.insert(0, value)
997
	path = ['.'.join(path) + ':', ]
998
	if rel_path:
999
		if not include_rdn:
1000
			lst = rel_path.split(',')[1: -1]
1001
		else:
1002
			lst = rel_path.split(',')[: -1]
1003
		for item in lst:
1004
			if not item:
1005
				continue
1006
			dummy, value = item.split('=', 1)
1007
			path.insert(1, value)
1008
		if not lst:
1009
			path.insert(1, '')
1010
	else:
1011
		path.append('')
1012
	return '/'.join(path)
1013
994
1014
995
1015
@LDAP_Connection
996
@LDAP_Connection

Return to bug 42423