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

Collapse All | Expand All

(-)a/management/univention-directory-manager-modules/modules/univention/admin/handlers/settings/extended_attribute.py (+25 lines)
 Lines 378-383    Link Here 
378
		identifies=False,
378
		identifies=False,
379
		copyable=True,
379
		copyable=True,
380
	),
380
	),
381
	'mapMethod': univention.admin.property(
382
		short_description=_('Map method'),
383
		long_description=_('Defines a custom UDM property to LDAP attribute mapping method.'),
384
		syntax=univention.admin.syntax.string,
385
		multivalue=False,
386
		options=[],
387
		required=False,
388
		may_change=True,
389
		identifies=False,
390
		copyable=True,
391
	),
392
	'unmapMethod': univention.admin.property(
393
		short_description=_('Unmap method'),
394
		long_description=_('Defines a custom LDAP attribute to UDM property mapping method.'),
395
		syntax=univention.admin.syntax.string,
396
		multivalue=False,
397
		options=[],
398
		required=False,
399
		may_change=True,
400
		identifies=False,
401
		copyable=True,
402
	),
381
}
403
}
382
404
383
layout = [
405
layout = [
 Lines 425-430    Link Here 
425
	]),
447
	]),
426
	Tab(_('Data type'), _('Data type definition'), layout=[
448
	Tab(_('Data type'), _('Data type definition'), layout=[
427
		["syntax", "default"],
449
		["syntax", "default"],
450
		["mapMethod", "unmapMethod"],
428
		["multivalue"],
451
		["multivalue"],
429
		["valueRequired"],
452
		["valueRequired"],
430
		["mayChange"],
453
		["mayChange"],
 Lines 459-464    Link Here 
459
mapping.register('notEditable', 'univentionUDMPropertyValueNotEditable', None, univention.admin.mapping.ListToString)
482
mapping.register('notEditable', 'univentionUDMPropertyValueNotEditable', None, univention.admin.mapping.ListToString)
460
mapping.register('doNotSearch', 'univentionUDMPropertyDoNotSearch', None, univention.admin.mapping.ListToString)
483
mapping.register('doNotSearch', 'univentionUDMPropertyDoNotSearch', None, univention.admin.mapping.ListToString)
461
mapping.register('copyable', 'univentionUDMPropertyCopyable', None, univention.admin.mapping.ListToString)
484
mapping.register('copyable', 'univentionUDMPropertyCopyable', None, univention.admin.mapping.ListToString)
485
mapping.register('mapMethod', 'univentionUDMPropertyMapMethod', None, univention.admin.mapping.ListToString)
486
mapping.register('unmapMethod', 'univentionUDMPropertyUnMapMethod', None, univention.admin.mapping.ListToString)
462
mapping.register('version', 'univentionUDMPropertyVersion', None, univention.admin.mapping.ListToString)
487
mapping.register('version', 'univentionUDMPropertyVersion', None, univention.admin.mapping.ListToString)
463
mapping.register('CLIName', 'univentionUDMPropertyCLIName', None, univention.admin.mapping.ListToString)
488
mapping.register('CLIName', 'univentionUDMPropertyCLIName', None, univention.admin.mapping.ListToString)
464
mapping.register('options', 'univentionUDMPropertyOptions')
489
mapping.register('options', 'univentionUDMPropertyOptions')
(-)a/management/univention-directory-manager-modules/modules/univention/admin/modules.py (-14 / +17 lines)
 Lines 311-331   def update_extended_attributes(lo, module, position): Link Here 
311
			ud.debug(ud.ADMIN, ud.ERROR, 'modules update_extended_attributes: ERROR: processing univentionUDMPropertyDoNotSearch throwed exception - assuming doNotSearch=0')
311
			ud.debug(ud.ADMIN, ud.ERROR, 'modules update_extended_attributes: ERROR: processing univentionUDMPropertyDoNotSearch throwed exception - assuming doNotSearch=0')
312
			doNotSearch = 0
312
			doNotSearch = 0
313
313
314
		map_method = ''
315
		unmap_method = ''
316
314
		# check if CA is multivalue property
317
		# check if CA is multivalue property
315
		if attrs.get('univentionUDMPropertyMultivalue', [''])[0] == '1':
318
		multivalue = attrs.get('univentionUDMPropertyMultivalue', [''])[0] == '1'
316
			multivalue = 1
319
		if not multivalue:
317
			map_method = None
320
			map_method = 'ListToString'
318
			unmap_method = None
319
		else:
320
			multivalue = 0
321
			map_method = univention.admin.mapping.ListToString
322
			unmap_method = None
323
			if propertySyntaxString == 'boolean':
321
			if propertySyntaxString == 'boolean':
324
				map_method = univention.admin.mapping.BooleanListToString
322
				map_method = 'BooleanListToString'
325
				unmap_method = univention.admin.mapping.BooleanUnMap
323
				unmap_method = 'BooleanUnMap'
326
			# single value ==> use only first value
324
			# single value ==> use only first value
327
			propertyDefault = propertyDefault[0]
325
			propertyDefault = propertyDefault[0]
328
326
327
		# extended attribute for objectClass should not be mapped to any attribute/property
328
		if attrs['univentionUDMPropertyLdapMapping'][0].lower() == 'objectClass'.lower():
329
			map_method = 'nothing'
330
			unmap_method = 'nothing'
331
332
		map_method = getattr(univention.admin.mapping, attrs.get('univentionUDMPropertyMapMethod', [map_method])[0], None)
333
		unmap_method = getattr(univention.admin.mapping, attrs.get('univentionUDMPropertyUnMapMethod', [unmap_method])[0], None)
334
329
		# Show this attribute in UDM/UMC?
335
		# Show this attribute in UDM/UMC?
330
		if attrs.get('univentionUDMPropertyLayoutDisable', [''])[0] == '1':
336
		if attrs.get('univentionUDMPropertyLayoutDisable', [''])[0] == '1':
331
			layoutDisabled = True
337
			layoutDisabled = True
 Lines 363-372   def update_extended_attributes(lo, module, position): Link Here 
363
		)
369
		)
364
370
365
		# add LDAP mapping
371
		# add LDAP mapping
366
		if attrs['univentionUDMPropertyLdapMapping'][0].lower() != 'objectClass'.lower():
372
		module.mapping.register(pname, attrs['univentionUDMPropertyLdapMapping'][0], unmap_method, map_method)
367
			module.mapping.register(pname, attrs['univentionUDMPropertyLdapMapping'][0], unmap_method, map_method)
368
		else:
369
			module.mapping.register(pname, attrs['univentionUDMPropertyLdapMapping'][0], univention.admin.mapping.nothing, univention.admin.mapping.nothing)
370
373
371
		if hasattr(module, 'layout'):
374
		if hasattr(module, 'layout'):
372
			tabname = attrs.get('univentionUDMPropertyTranslationTabName;entry-%s' % lang, attrs.get('univentionUDMPropertyLayoutTabName', [_('Custom')]))[0]
375
			tabname = attrs.get('univentionUDMPropertyTranslationTabName;entry-%s' % lang, attrs.get('univentionUDMPropertyLayoutTabName', [_('Custom')]))[0]
(-)a/management/univention-ldap/schema/custom-attribute.schema (+12 lines)
 Lines 291-296   attributetype ( 1.3.6.1.4.1.10176.200.131 NAME 'univentionUDMPropertyCopyable' Link Here 
291
        SUBSTR caseIgnoreSubstringsMatch
291
        SUBSTR caseIgnoreSubstringsMatch
292
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE)
292
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE)
293
293
294
attributetype ( 1.3.6.1.4.1.10176.200.132 NAME 'univentionUDMPropertyMapMethod'
295
        DESC 'defines the UDM property to LDAP attribute mapping method'
296
        EQUALITY caseIgnoreMatch
297
        SUBSTR caseIgnoreSubstringsMatch
298
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE)
299
300
attributetype ( 1.3.6.1.4.1.10176.200.133 NAME 'univentionUDMPropertyUnMapMethod'
301
        DESC 'defines the LDAP attribute to UDM property mapping method'
302
        EQUALITY caseIgnoreMatch
303
        SUBSTR caseIgnoreSubstringsMatch
304
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE)
305
294
306
295
objectclass ( 1.3.6.1.4.1.10176.200.199
307
objectclass ( 1.3.6.1.4.1.10176.200.199
296
    NAME 'univentionUDMProperty'
308
    NAME 'univentionUDMProperty'
297
   Bug #43129: add loading of mapping.d
309
   Bug #43129: add loading of mapping.d
(-)a/management/univention-directory-manager-modules/debian/python-univention-directory-manager.install (+1 lines)
 Lines 15-20   modules/univention/admin/handlers/computers/*.py usr/share/pyshared/univention/a Link Here 
15
modules/univention/admin/handlers/kerberos/*.py usr/share/pyshared/univention/admin/handlers/kerberos/
15
modules/univention/admin/handlers/kerberos/*.py usr/share/pyshared/univention/admin/handlers/kerberos/
16
modules/univention/admin/syntax.d/*.py usr/share/pyshared/univention/admin/syntax.d/
16
modules/univention/admin/syntax.d/*.py usr/share/pyshared/univention/admin/syntax.d/
17
modules/univention/admin/hooks.d/*.py usr/share/pyshared/univention/admin/hooks.d/
17
modules/univention/admin/hooks.d/*.py usr/share/pyshared/univention/admin/hooks.d/
18
modules/univention/admin/mapping.d/*.py usr/share/pyshared/univention/admin/mapping.d/
18
python-lib/*.py usr/share/pyshared/univention/lib
19
python-lib/*.py usr/share/pyshared/univention/lib
19
listener/*.py usr/lib/univention-directory-listener/system/
20
listener/*.py usr/lib/univention-directory-listener/system/
20
18python-univention-directory-manager.inst usr/lib/univention-install/
21
18python-univention-directory-manager.inst usr/lib/univention-install/
(-)a/management/univention-directory-manager-modules/modules/univention/admin/__init__.py (+1 lines)
 Lines 513-518   def __init__(self, id, short_description=None, long_description='', members=[]): Link Here 
513
from univention.admin import modules, objects, syntax, hook, mapping
513
from univention.admin import modules, objects, syntax, hook, mapping
514
syntax.import_syntax_files()
514
syntax.import_syntax_files()
515
hook.import_hook_files()
515
hook.import_hook_files()
516
mapping.import_mapping_files()
516
517
517
if __name__ == '__main__':
518
if __name__ == '__main__':
518
	prop = property('_replace')
519
	prop = property('_replace')
(-)a/management/univention-directory-manager-modules/modules/univention/admin/mapping.py (+21 lines)
 Lines 33-38    Link Here 
33
import univention.debug
33
import univention.debug
34
import types
34
import types
35
import base64
35
import base64
36
import traceback
37
import sys
38
import os
39
40
41
def import_mapping_files():
42
	for dir_ in sys.path:
43
		mapping_py = os.path.join(dir_, 'univention/admin/mapping.py')
44
		mapping_d = os.path.join(dir_, 'univention/admin/mapping.d/')
45
46
		if os.path.exists(mapping_py) and os.path.isdir(mapping_d):
47
			mapping_files = (os.path.join(mapping_d, f) for f in os.listdir(mapping_d) if f.endswith('.py'))
48
49
			for fn in mapping_files:
50
				try:
51
					with open(fn, 'r') as fd:
52
						exec fd in sys.modules[__name__].__dict__
53
					univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'admin.mapping.import_mapping_files: importing "%s"' % fn)
54
				except (EnvironmentError, ImportError):
55
					univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, 'admin.mapping.import_mapping_files: loading %s failed' % fn)
56
					univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, 'admin.mapping.import_mapping_files: TRACEBACK:\n%s' % traceback.format_exc())
36
57
37
58
38
def DaysToSeconds(days):
59
def DaysToSeconds(days):

Return to bug 43129