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

Collapse All | Expand All

(-)a/management/univention-directory-manager-modules/modules/univention/admin/handlers/container/cn.py (-30 / +41 lines)
 Lines 209-214   mapping.register('description', 'description', None, univention.admin.mapping.Li Link Here 
209
class object(univention.admin.handlers.simpleLdap):
209
class object(univention.admin.handlers.simpleLdap):
210
	module = module
210
	module = module
211
211
212
	PATH_KEYS = {
213
		'userPath': 'univentionUsersObject',
214
		'groupPath': 'univentionGroupsObject',
215
		'computerPath': 'univentionComputersObject',
216
		'policyPath': 'univentionPolicyObject',
217
		'dnsPath': 'univentionDnsObject',
218
		'dhcpPath': 'univentionDhcpObject',
219
		'networkPath': 'univentionNetworksObject',
220
		'sharePath': 'univentionSharesObject',
221
		'printerPath': 'univentionPrintersObject',
222
		'mailPath': 'univentionMailObject',
223
		'licensePath': 'univentionLicenseObject',
224
	}
225
212
	def open(self):
226
	def open(self):
213
		univention.admin.handlers.simpleLdap.open(self)
227
		univention.admin.handlers.simpleLdap.open(self)
214
228
 Lines 218-249   class object(univention.admin.handlers.simpleLdap): Link Here 
218
			pathResult = self.lo.get('cn=default containers,cn=univention,' + self.position.getDomain())
232
			pathResult = self.lo.get('cn=default containers,cn=univention,' + self.position.getDomain())
219
			self.default_dn = 'cn=default containers,cn=univention,' + self.position.getDomain()
233
			self.default_dn = 'cn=default containers,cn=univention,' + self.position.getDomain()
220
234
221
		self.pathKeys = ['userPath', 'groupPath', 'computerPath', 'policyPath', 'dnsPath', 'dhcpPath', 'networkPath', 'sharePath', 'printerPath', 'mailPath', 'licensePath']
235
		for prop in self.PATH_KEYS:
222
		self.ldapKeys = ['univentionUsersObject', 'univentionGroupsObject', 'univentionComputersObject', 'univentionPolicyObject', 'univentionDnsObject', 'univentionDhcpObject', 'univentionNetworksObject', 'univentionSharesObject', 'univentionPrintersObject', 'univentionMailObject', 'univentionLicenseObject']
236
			self[prop] = '0'
223
224
		for key in self.pathKeys:
225
			self[key] = '0'
226
237
227
		for i in range(0, len(self.pathKeys)):
238
		for prop in self.PATH_KEYS:
228
			if pathResult.has_key(self.ldapKeys[i]):
239
			if prop in pathResult:
229
				for j in pathResult[self.ldapKeys[i]]:
240
				for j in pathResult[prop]:
230
					if j == self.dn:
241
					if j == self.dn:
231
						self[self.pathKeys[i]] = '1'
242
						self[prop] = '1'
232
243
233
		self.save()
244
		self.save()
234
245
235
	def _ldap_post_create(self):
246
	def _ldap_post_create(self):
236
		changes = []
247
		changes = []
237
248
238
		for i in range(0, len(self.pathKeys)):
249
		for (prop, attr) in self.PATH_KEYS.items():
239
			if self.oldinfo[self.pathKeys[i]] != self.info[self.pathKeys[i]]:
250
			if self.oldinfo.get(prop) != self.info.get(prop):
240
				entries = self.lo.getAttr(self.default_dn, self.ldapKeys[i])
251
				entries = self.lo.getAttr(self.default_dn, attr)
241
				if self.info[self.pathKeys[i]] == '0':
252
				if self.info[prop] == '0':
242
					if self.dn in entries:
253
					if self.dn in entries:
243
						changes.append((self.ldapKeys[i], self.dn, ''))
254
						changes.append((attr, self.dn, ''))
244
				else:
255
				else:
245
					if self.dn not in entries:
256
					if self.dn not in entries:
246
						changes.append((self.ldapKeys[i], '', self.dn))
257
						changes.append((attr, '', self.dn))
247
258
248
		if changes:
259
		if changes:
249
			self.lo.modify(self.default_dn, changes)
260
			self.lo.modify(self.default_dn, changes)
 Lines 253-270   class object(univention.admin.handlers.simpleLdap): Link Here 
253
			newdn = 'cn=%s,%s' % (ldap.dn.escape_dn_chars(self.info['name']), self.lo.parentDn(self.dn))
264
			newdn = 'cn=%s,%s' % (ldap.dn.escape_dn_chars(self.info['name']), self.lo.parentDn(self.dn))
254
			self.move(newdn)
265
			self.move(newdn)
255
266
256
	def _ldap_post_modify(self):
257
		changes = []
258
259
		for i in range(0, len(self.pathKeys)):
260
			if self.oldinfo[self.pathKeys[i]] != self.info[self.pathKeys[i]]:
261
				if self.info[self.pathKeys[i]] == '0':
262
					changes.append((self.ldapKeys[i], self.dn, ''))
263
				else:
264
					changes.append((self.ldapKeys[i], '', self.dn))
265
		if changes:
266
			self.lo.modify(self.default_dn, changes)
267
268
	def _ldap_post_move(self, olddn):
267
	def _ldap_post_move(self, olddn):
269
		settings_module = univention.admin.modules.get('settings/directory')
268
		settings_module = univention.admin.modules.get('settings/directory')
270
		settings_object = univention.admin.objects.get(settings_module, None, self.lo, position='', dn=self.default_dn)
269
		settings_object = univention.admin.objects.get(settings_module, None, self.lo, position='', dn=self.default_dn)
 Lines 275-288   class object(univention.admin.handlers.simpleLdap): Link Here 
275
				settings_object[attr].append(self.dn)
274
				settings_object[attr].append(self.dn)
276
		settings_object.modify()
275
		settings_object.modify()
277
276
277
	def _ldap_post_modify(self):
278
		changes = []
279
280
		for prop, attr in self.PATH_KEYS.items():
281
			if self.oldinfo.get(prop) != self.info.get(prop):
282
				if self.info[prop] == '0':
283
					changes.append((attr, self.dn, ''))
284
				else:
285
					changes.append((attr, '', self.dn))
286
		if changes:
287
			self.lo.modify(self.default_dn, changes)
288
278
	def _ldap_pre_remove(self):
289
	def _ldap_pre_remove(self):
279
		changes = []
290
		changes = []
280
291
281
		self.open()
292
		self.open()
282
293
283
		for i in range(0, len(self.pathKeys)):
294
		for prop, attr in self.PATH_KEYS.items():
284
			if self.oldinfo[self.pathKeys[i]] == '1':
295
			if self.oldinfo.get(prop) == '1':
285
				changes.append((self.ldapKeys[i], self.dn, ''))
296
				changes.append((attr, self.dn, ''))
286
		self.lo.modify(self.default_dn, changes)
297
		self.lo.modify(self.default_dn, changes)
287
298
288
	def _ldap_addlist(self):
299
	def _ldap_addlist(self):
(-)a/management/univention-directory-manager-modules/modules/univention/admin/handlers/container/ou.py (-25 / +35 lines)
 Lines 190-196   property_descriptions = { Link Here 
190
layout = [
190
layout = [
191
	Tab(_('General'), _('Basic settings'), layout=[
191
	Tab(_('General'), _('Basic settings'), layout=[
192
		Group(_('Organisational unit description'), layout=[
192
		Group(_('Organisational unit description'), layout=[
193
			["name", "description"]
193
			["name", "description"],
194
		]),
194
		]),
195
	]),
195
	]),
196
	Tab(_('Container settings'), _('Default position when adding objects'), advanced=True, layout=[
196
	Tab(_('Container settings'), _('Default position when adding objects'), advanced=True, layout=[
 Lines 211-216   mapping.register('description', 'description', None, univention.admin.mapping.Li Link Here 
211
class object(univention.admin.handlers.simpleLdap):
211
class object(univention.admin.handlers.simpleLdap):
212
	module = module
212
	module = module
213
213
214
	PATH_KEYS = {
215
		'userPath': 'univentionUsersObject',
216
		'groupPath': 'univentionGroupsObject',
217
		'computerPath': 'univentionComputersObject',
218
		'policyPath': 'univentionPolicyObject',
219
		'dnsPath': 'univentionDnsObject',
220
		'dhcpPath': 'univentionDhcpObject',
221
		'networkPath': 'univentionNetworksObject',
222
		'sharePath': 'univentionSharesObject',
223
		'printerPath': 'univentionPrintersObject',
224
		'mailPath': 'univentionMailObject',
225
		'licensePath': 'univentionLicenseObject',
226
	}
227
214
	def open(self):
228
	def open(self):
215
		univention.admin.handlers.simpleLdap.open(self)
229
		univention.admin.handlers.simpleLdap.open(self)
216
230
 Lines 220-236   class object(univention.admin.handlers.simpleLdap): Link Here 
220
			pathResult = self.lo.get('cn=default containers,cn=univention,' + self.position.getDomain())
234
			pathResult = self.lo.get('cn=default containers,cn=univention,' + self.position.getDomain())
221
			self.default_dn = 'cn=default containers,cn=univention,' + self.position.getDomain()
235
			self.default_dn = 'cn=default containers,cn=univention,' + self.position.getDomain()
222
236
223
		self.pathKeys = ['userPath', 'groupPath', 'computerPath', 'policyPath', 'dnsPath', 'dhcpPath', 'networkPath', 'sharePath', 'printerPath', 'mailPath', 'licensePath']
237
		for prop in self.PATH_KEYS:
224
		self.ldapKeys = ['univentionUsersObject', 'univentionGroupsObject', 'univentionComputersObject', 'univentionPolicyObject', 'univentionDnsObject', 'univentionDhcpObject', 'univentionNetworksObject', 'univentionSharesObject', 'univentionPrintersObject', 'univentionMailObject', 'univentionLicenseObject']
238
			self[prop] = '0'
225
226
		for key in self.pathKeys:
227
			self[key] = '0'
228
239
229
		for i in range(0, len(self.pathKeys)):
240
		for prop in self.PATH_KEYS:
230
			if pathResult.has_key(self.ldapKeys[i]):
241
			if prop in pathResult:
231
				for j in pathResult[self.ldapKeys[i]]:
242
				for j in pathResult[prop]:
232
					if j == self.dn:
243
					if j == self.dn:
233
						self[self.pathKeys[i]] = '1'
244
						self[prop] = '1'
234
245
235
		self.save()
246
		self.save()
236
247
 Lines 248-262   class object(univention.admin.handlers.simpleLdap): Link Here 
248
	def _ldap_post_create(self):
259
	def _ldap_post_create(self):
249
		changes = []
260
		changes = []
250
261
251
		for i in range(0, len(self.pathKeys)):
262
		for (prop, attr) in self.PATH_KEYS.items():
252
			if self.oldinfo[self.pathKeys[i]] != self.info[self.pathKeys[i]]:
263
			if self.oldinfo.get(prop) != self.info.get(prop):
253
				entries = self.lo.getAttr(self.default_dn, self.ldapKeys[i])
264
				entries = self.lo.getAttr(self.default_dn, attr)
254
				if self.info[self.pathKeys[i]] == '0':
265
				if self.info[prop] == '0':
255
					if self.dn in entries:
266
					if self.dn in entries:
256
						changes.append((self.ldapKeys[i], self.dn, ''))
267
						changes.append((attr, self.dn, ''))
257
				else:
268
				else:
258
					if self.dn not in entries:
269
					if self.dn not in entries:
259
						changes.append((self.ldapKeys[i], '', self.dn))
270
						changes.append((attr, '', self.dn))
260
271
261
		if changes:
272
		if changes:
262
			self.lo.modify(self.default_dn, changes)
273
			self.lo.modify(self.default_dn, changes)
 Lines 279-290   class object(univention.admin.handlers.simpleLdap): Link Here 
279
	def _ldap_post_modify(self):
290
	def _ldap_post_modify(self):
280
		changes = []
291
		changes = []
281
292
282
		for i in range(0, len(self.pathKeys)):
293
		for prop, attr in self.PATH_KEYS.items():
283
			if self.oldinfo[self.pathKeys[i]] != self.info[self.pathKeys[i]]:
294
			if self.oldinfo.get(prop) != self.info.get(prop):
284
				if self.info[self.pathKeys[i]] == '0':
295
				if self.info[prop] == '0':
285
					changes.append((self.ldapKeys[i], self.dn, ''))
296
					changes.append((attr, self.dn, ''))
286
				else:
297
				else:
287
					changes.append((self.ldapKeys[i], '', self.dn))
298
					changes.append((attr, '', self.dn))
288
		if changes:
299
		if changes:
289
			self.lo.modify(self.default_dn, changes)
300
			self.lo.modify(self.default_dn, changes)
290
301
 Lines 293-301   class object(univention.admin.handlers.simpleLdap): Link Here 
293
304
294
		self.open()
305
		self.open()
295
306
296
		for i in range(0, len(self.pathKeys)):
307
		for prop, attr in self.PATH_KEYS.items():
297
			if self.oldinfo[self.pathKeys[i]] == '1':
308
			if self.oldinfo.get(prop) == '1':
298
				changes.append((self.ldapKeys[i], self.dn, ''))
309
				changes.append((attr, self.dn, ''))
299
		self.lo.modify(self.default_dn, changes)
310
		self.lo.modify(self.default_dn, changes)
300
311
301
	def _ldap_addlist(self):
312
	def _ldap_addlist(self):
302
- 

Return to bug 43396