|
85 |
msgs = [] |
85 |
msgs = [] |
86 |
for iarg in err.args: |
86 |
for iarg in err.args: |
87 |
if isinstance(iarg, dict): |
87 |
if isinstance(iarg, dict): |
88 |
msg = ': '.join([str(m) for m in (iarg.get('desc'), iarg.get('info')) if m]) |
88 |
matched = 'matched %s' % (iarg['matched'],) if 'matched' in iarg else '' |
|
|
89 |
msg = ': '.join([str(m) for m in (iarg.get('desc'), iarg.get('info'), matched) if m]) |
89 |
else: |
90 |
else: |
90 |
msg = str(iarg) |
91 |
msg = str(iarg) |
91 |
if msg: |
92 |
if msg: |
Lines 358-364
def search(self, filter='(objectClass=*)', base='', scope='sub', attr=[], unique
|
Link Here
|
---|
|
358 |
try: |
359 |
try: |
359 |
return self.lo.search(filter, base, scope, attr, unique, required, timeout, sizelimit) |
360 |
return self.lo.search(filter, base, scope, attr, unique, required, timeout, sizelimit) |
360 |
except ldap.NO_SUCH_OBJECT as msg: |
361 |
except ldap.NO_SUCH_OBJECT as msg: |
361 |
raise univention.admin.uexceptions.noObject(_err2str(msg)) |
362 |
raise univention.admin.uexceptions.noObject(base, _err2str(msg)) |
362 |
except ldap.INAPPROPRIATE_MATCHING as msg: |
363 |
except ldap.INAPPROPRIATE_MATCHING as msg: |
363 |
raise univention.admin.uexceptions.insufficientInformation(_err2str(msg)) |
364 |
raise univention.admin.uexceptions.insufficientInformation(_err2str(msg)) |
364 |
except (ldap.TIMEOUT, ldap.TIMELIMIT_EXCEEDED) as msg: |
365 |
except (ldap.TIMEOUT, ldap.TIMELIMIT_EXCEEDED) as msg: |
Lines 374-380
def searchDn(self, filter='(objectClass=*)', base='', scope='sub', unique=False,
|
Link Here
|
---|
|
374 |
try: |
375 |
try: |
375 |
return self.lo.searchDn(filter, base, scope, unique, required, timeout, sizelimit) |
376 |
return self.lo.searchDn(filter, base, scope, unique, required, timeout, sizelimit) |
376 |
except ldap.NO_SUCH_OBJECT as msg: |
377 |
except ldap.NO_SUCH_OBJECT as msg: |
377 |
raise univention.admin.uexceptions.noObject(_err2str(msg)) |
378 |
raise univention.admin.uexceptions.noObject(base, _err2str(msg)) |
378 |
except ldap.INAPPROPRIATE_MATCHING as msg: |
379 |
except ldap.INAPPROPRIATE_MATCHING as msg: |
379 |
raise univention.admin.uexceptions.insufficientInformation(_err2str(msg)) |
380 |
raise univention.admin.uexceptions.insufficientInformation(_err2str(msg)) |
380 |
except (ldap.TIMEOUT, ldap.TIMELIMIT_EXCEEDED) as msg: |
381 |
except (ldap.TIMEOUT, ldap.TIMELIMIT_EXCEEDED) as msg: |
Lines 407-412
def add(self, dn, al, exceptions=False):
|
Link Here
|
---|
|
407 |
except ldap.INSUFFICIENT_ACCESS as msg: |
408 |
except ldap.INSUFFICIENT_ACCESS as msg: |
408 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'add dn=%s err=%s' % (dn, msg)) |
409 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'add dn=%s err=%s' % (dn, msg)) |
409 |
raise univention.admin.uexceptions.permissionDenied |
410 |
raise univention.admin.uexceptions.permissionDenied |
|
|
411 |
except ldap.NO_SUCH_OBJECT as msg: |
412 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'add dn=%s err=%s' % (dn, msg)) |
413 |
raise univention.admin.uexceptions.noObject(dn, _err2str(msg)) |
410 |
except ldap.LDAPError as msg: |
414 |
except ldap.LDAPError as msg: |
411 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'add dn=%s err=%s' % (dn, msg)) |
415 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'add dn=%s err=%s' % (dn, msg)) |
412 |
raise univention.admin.uexceptions.ldapError(_err2str(msg), original_exception=msg) |
416 |
raise univention.admin.uexceptions.ldapError(_err2str(msg), original_exception=msg) |
Lines 424-430
def modify(self, dn, changes, exceptions=False, ignore_license=0):
|
Link Here
|
---|
|
424 |
return self.lo.modify(dn, changes) |
428 |
return self.lo.modify(dn, changes) |
425 |
except ldap.NO_SUCH_OBJECT as msg: |
429 |
except ldap.NO_SUCH_OBJECT as msg: |
426 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'mod dn=%s err=%s' % (dn, msg)) |
430 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'mod dn=%s err=%s' % (dn, msg)) |
427 |
raise univention.admin.uexceptions.noObject(dn) |
431 |
raise univention.admin.uexceptions.noObject(dn, _err2str(msg)) |
428 |
except ldap.INSUFFICIENT_ACCESS as msg: |
432 |
except ldap.INSUFFICIENT_ACCESS as msg: |
429 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'mod dn=%s err=%s' % (dn, msg)) |
433 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'mod dn=%s err=%s' % (dn, msg)) |
430 |
raise univention.admin.uexceptions.permissionDenied |
434 |
raise univention.admin.uexceptions.permissionDenied |
Lines 433-440
def modify(self, dn, changes, exceptions=False, ignore_license=0):
|
Link Here
|
---|
|
433 |
raise univention.admin.uexceptions.ldapError(_err2str(msg), original_exception=msg) |
437 |
raise univention.admin.uexceptions.ldapError(_err2str(msg), original_exception=msg) |
434 |
|
438 |
|
435 |
def rename(self, dn, newdn, move_childs=0, ignore_license=False): |
439 |
def rename(self, dn, newdn, move_childs=0, ignore_license=False): |
436 |
if not move_childs == 0: |
440 |
if move_childs: |
437 |
raise univention.admin.uexceptions.noObject(_("Moving children is not supported.")) |
441 |
raise univention.admin.uexceptions.noObject(dn, _("Moving children is not supported.")) |
438 |
self._validateLicense() |
442 |
self._validateLicense() |
439 |
if not self.allow_modify and not ignore_license: |
443 |
if not self.allow_modify and not ignore_license: |
440 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.WARN, 'move dn: %s' % dn) |
444 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.WARN, 'move dn: %s' % dn) |
Lines 445-451
def rename(self, dn, newdn, move_childs=0, ignore_license=False):
|
Link Here
|
---|
|
445 |
return self.lo.rename(dn, newdn) |
449 |
return self.lo.rename(dn, newdn) |
446 |
except ldap.NO_SUCH_OBJECT as msg: |
450 |
except ldap.NO_SUCH_OBJECT as msg: |
447 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'ren dn=%s err=%s' % (dn, msg)) |
451 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'ren dn=%s err=%s' % (dn, msg)) |
448 |
raise univention.admin.uexceptions.noObject(dn) |
452 |
raise univention.admin.uexceptions.noObject(dn, _err2str(msg)) |
449 |
except ldap.INSUFFICIENT_ACCESS as msg: |
453 |
except ldap.INSUFFICIENT_ACCESS as msg: |
450 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'ren dn=%s err=%s' % (dn, msg)) |
454 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'ren dn=%s err=%s' % (dn, msg)) |
451 |
raise univention.admin.uexceptions.permissionDenied |
455 |
raise univention.admin.uexceptions.permissionDenied |
Lines 465-471
def delete(self, dn, exceptions=False):
|
Link Here
|
---|
|
465 |
return self.lo.delete(dn) |
469 |
return self.lo.delete(dn) |
466 |
except ldap.NO_SUCH_OBJECT as msg: |
470 |
except ldap.NO_SUCH_OBJECT as msg: |
467 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'del dn=%s err=%s' % (dn, msg)) |
471 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'del dn=%s err=%s' % (dn, msg)) |
468 |
raise univention.admin.uexceptions.noObject(dn) |
472 |
raise univention.admin.uexceptions.noObject(dn, _err2str(msg)) |
469 |
except ldap.INSUFFICIENT_ACCESS as msg: |
473 |
except ldap.INSUFFICIENT_ACCESS as msg: |
470 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'del dn=%s err=%s' % (dn, msg)) |
474 |
univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'del dn=%s err=%s' % (dn, msg)) |
471 |
raise univention.admin.uexceptions.permissionDenied |
475 |
raise univention.admin.uexceptions.permissionDenied |