View | Details | Raw Unified | Return to bug 37584 | Differences between
and this patch

Collapse All | Expand All

(-)management/univention-directory-manager-modules/modules/univention/admin/uldap.py (-8 / +12 lines)
 Lines 191-197   def _err2str(err): Link Here 
191
	msgs = []
191
	msgs = []
192
	for iarg in err.args:
192
	for iarg in err.args:
193
		if isinstance(iarg, dict):
193
		if isinstance(iarg, dict):
194
			msg = ': '.join([str(m) for m in (iarg.get('desc'), iarg.get('info')) if m])
194
			matched = 'matched %s' % (iarg['matched'],) if 'matched' in iarg else ''
195
			msg = ': '.join([str(m) for m in (iarg.get('desc'), iarg.get('info'), matched) if m])
195
		else:
196
		else:
196
			msg = str(iarg)
197
			msg = str(iarg)
197
		if msg:
198
		if msg:
 Lines 668-674   class access(object): Link Here 
668
		try:
669
		try:
669
			return self.lo.search(filter, base, scope, attr, unique, required, timeout, sizelimit, serverctrls=serverctrls, response=response)
670
			return self.lo.search(filter, base, scope, attr, unique, required, timeout, sizelimit, serverctrls=serverctrls, response=response)
670
		except ldap.NO_SUCH_OBJECT as msg:
671
		except ldap.NO_SUCH_OBJECT as msg:
671
			raise univention.admin.uexceptions.noObject(_err2str(msg))
672
			raise univention.admin.uexceptions.noObject('%s: %s' % (_err2str(msg), base))
672
		except ldap.INAPPROPRIATE_MATCHING as msg:
673
		except ldap.INAPPROPRIATE_MATCHING as msg:
673
			raise univention.admin.uexceptions.insufficientInformation(_err2str(msg))
674
			raise univention.admin.uexceptions.insufficientInformation(_err2str(msg))
674
		except (ldap.TIMEOUT, ldap.TIMELIMIT_EXCEEDED) as msg:
675
		except (ldap.TIMEOUT, ldap.TIMELIMIT_EXCEEDED) as msg:
 Lines 710-716   class access(object): Link Here 
710
		try:
711
		try:
711
			return self.lo.searchDn(filter, base, scope, unique, required, timeout, sizelimit, serverctrls=serverctrls, response=response)
712
			return self.lo.searchDn(filter, base, scope, unique, required, timeout, sizelimit, serverctrls=serverctrls, response=response)
712
		except ldap.NO_SUCH_OBJECT as msg:
713
		except ldap.NO_SUCH_OBJECT as msg:
713
			raise univention.admin.uexceptions.noObject(_err2str(msg))
714
			raise univention.admin.uexceptions.noObject('%s: %s' % (_err2str(msg), base))
714
		except ldap.INAPPROPRIATE_MATCHING as msg:
715
		except ldap.INAPPROPRIATE_MATCHING as msg:
715
			raise univention.admin.uexceptions.insufficientInformation(_err2str(msg))
716
			raise univention.admin.uexceptions.insufficientInformation(_err2str(msg))
716
		except (ldap.TIMEOUT, ldap.TIMELIMIT_EXCEEDED) as msg:
717
		except (ldap.TIMEOUT, ldap.TIMELIMIT_EXCEEDED) as msg:
 Lines 773-778   class access(object): Link Here 
773
			raise univention.admin.uexceptions.permissionDenied()
774
			raise univention.admin.uexceptions.permissionDenied()
774
		except ldap.INVALID_DN_SYNTAX as msg:
775
		except ldap.INVALID_DN_SYNTAX as msg:
775
			raise univention.admin.uexceptions.ldapError('%s: %s' % (_err2str(msg), dn), original_exception=msg)
776
			raise univention.admin.uexceptions.ldapError('%s: %s' % (_err2str(msg), dn), original_exception=msg)
777
		except ldap.NO_SUCH_OBJECT as msg:
778
			ud.debug(ud.LDAP, ud.ALL, 'add dn=%s err=%s' % (dn, msg))
779
			raise univention.admin.uexceptions.ldapError('%s: %s' % (_err2str(msg), self.parentDn(dn)), original_exception=msg)
776
		except ldap.LDAPError as msg:
780
		except ldap.LDAPError as msg:
777
			ud.debug(ud.LDAP, ud.ALL, 'add dn=%s err=%s' % (dn, msg))
781
			ud.debug(ud.LDAP, ud.ALL, 'add dn=%s err=%s' % (dn, msg))
778
			raise univention.admin.uexceptions.ldapError(_err2str(msg), original_exception=msg)
782
			raise univention.admin.uexceptions.ldapError(_err2str(msg), original_exception=msg)
 Lines 803-809   class access(object): Link Here 
803
			return self.lo.modify(dn, changes, serverctrls=serverctrls, response=response)
807
			return self.lo.modify(dn, changes, serverctrls=serverctrls, response=response)
804
		except ldap.NO_SUCH_OBJECT as msg:
808
		except ldap.NO_SUCH_OBJECT as msg:
805
			ud.debug(ud.LDAP, ud.ALL, 'mod dn=%s err=%s' % (dn, msg))
809
			ud.debug(ud.LDAP, ud.ALL, 'mod dn=%s err=%s' % (dn, msg))
806
			raise univention.admin.uexceptions.noObject(dn)
810
			raise univention.admin.uexceptions.noObject('%s: %s' % (_err2str(msg), dn))
807
		except ldap.INSUFFICIENT_ACCESS as msg:
811
		except ldap.INSUFFICIENT_ACCESS as msg:
808
			ud.debug(ud.LDAP, ud.ALL, 'mod dn=%s err=%s' % (dn, msg))
812
			ud.debug(ud.LDAP, ud.ALL, 'mod dn=%s err=%s' % (dn, msg))
809
			raise univention.admin.uexceptions.permissionDenied()
813
			raise univention.admin.uexceptions.permissionDenied()
 Lines 826-833   class access(object): Link Here 
826
		:type serverctrls: list[ldap.controls.LDAPControl]
830
		:type serverctrls: list[ldap.controls.LDAPControl]
827
		:param dict response: An optional dictionary to receive the server controls of the result.
831
		:param dict response: An optional dictionary to receive the server controls of the result.
828
		"""
832
		"""
829
		if not move_childs == 0:
833
		if move_childs:
830
			raise univention.admin.uexceptions.noObject(_("Moving children is not supported."))
834
			raise univention.admin.uexceptions.noObject('%s: %s' % (_("Moving children is not supported."), dn))
831
		self._validateLicense()
835
		self._validateLicense()
832
		if not self.allow_modify and not ignore_license:
836
		if not self.allow_modify and not ignore_license:
833
			ud.debug(ud.ADMIN, ud.WARN, 'move dn: %s' % dn)
837
			ud.debug(ud.ADMIN, ud.WARN, 'move dn: %s' % dn)
 Lines 837-843   class access(object): Link Here 
837
			return self.lo.rename(dn, newdn, serverctrls=serverctrls, response=response)
841
			return self.lo.rename(dn, newdn, serverctrls=serverctrls, response=response)
838
		except ldap.NO_SUCH_OBJECT as msg:
842
		except ldap.NO_SUCH_OBJECT as msg:
839
			ud.debug(ud.LDAP, ud.ALL, 'ren dn=%s err=%s' % (dn, msg))
843
			ud.debug(ud.LDAP, ud.ALL, 'ren dn=%s err=%s' % (dn, msg))
840
			raise univention.admin.uexceptions.noObject(dn)
844
			raise univention.admin.uexceptions.noObject('%s: %s' % (_err2str(msg), dn, newdn))
841
		except ldap.INSUFFICIENT_ACCESS as msg:
845
		except ldap.INSUFFICIENT_ACCESS as msg:
842
			ud.debug(ud.LDAP, ud.ALL, 'ren dn=%s err=%s' % (dn, msg))
846
			ud.debug(ud.LDAP, ud.ALL, 'ren dn=%s err=%s' % (dn, msg))
843
			raise univention.admin.uexceptions.permissionDenied()
847
			raise univention.admin.uexceptions.permissionDenied()
 Lines 870-876   class access(object): Link Here 
870
			return self.lo.delete(dn)
874
			return self.lo.delete(dn)
871
		except ldap.NO_SUCH_OBJECT as msg:
875
		except ldap.NO_SUCH_OBJECT as msg:
872
			ud.debug(ud.LDAP, ud.ALL, 'del dn=%s err=%s' % (dn, msg))
876
			ud.debug(ud.LDAP, ud.ALL, 'del dn=%s err=%s' % (dn, msg))
873
			raise univention.admin.uexceptions.noObject(dn)
877
			raise univention.admin.uexceptions.noObject('%s: %s' % (_err2str(msg), dn))
874
		except ldap.INSUFFICIENT_ACCESS as msg:
878
		except ldap.INSUFFICIENT_ACCESS as msg:
875
			ud.debug(ud.LDAP, ud.ALL, 'del dn=%s err=%s' % (dn, msg))
879
			ud.debug(ud.LDAP, ud.ALL, 'del dn=%s err=%s' % (dn, msg))
876
			raise univention.admin.uexceptions.permissionDenied()
880
			raise univention.admin.uexceptions.permissionDenied()

Return to bug 37584