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

(-)conffiles/etc/univention/s4connector/s4/mapping.py (+1 lines)
 Lines 561-566    Link Here 
561
@!@
561
@!@
562
							univention.s4connector.s4.password.password_sync_s4_to_ucs_no_userpassword,
562
							univention.s4connector.s4.password.password_sync_s4_to_ucs_no_userpassword,
563
							univention.s4connector.s4.computer.checkAndConvertToMacOSX,
563
							univention.s4connector.s4.computer.checkAndConvertToMacOSX,
564
							univention.s4connector.s4.computer.windowscomputer_sync_s4_to_ucs_check_rename,
564
							],
565
							],
565
566
566
			attributes= {
567
			attributes= {
(-)modules/univention/s4connector/s4/computer.py (+24 lines)
 Lines 91-93    Link Here 
91
		return
91
		return
92
92
93
	_convertWinToMac(s4connector, sync_object)
93
	_convertWinToMac(s4connector, sync_object)
94
95
def windowscomputer_sync_s4_to_ucs_check_rename(s4connector, key, sync_object):
96
	ud.debug(ud.LDAP, ud.INFO, "con_check_rename: ucs_object: %s" % sync_object)
97
98
	attrs = sync_object.get('attributes')
99
	if not attrs:
100
		return
101
102
	uid = attrs.get('uid', [None])[0]
103
	if not uid:
104
		raise ValueError("%s has no uid" % (sync_object['dn'],))
105
106
	## Raises IndexError if neither cn nor CN is found in object:
107
	cn = [_value for _key, _value in attrs.iteritems() if 'cn' == _key.lower()][0]
108
109
	normal_cn = uid.rstrip('$')
110
	if cn == normal_cn:
111
		return
112
113
	ud.debug(ud.LDAP, ud.PROCESS, "con_check_rename: Renaming client from %s to %s" % (cn, normal_cn))
114
	ucs_admin_object = univention.admin.objects.get(s4connector.modules['windowscomputer'], co='', lo=s4connector.lo, position='', dn=sync_object['dn'])
115
	ucs_admin_object.open()
116
	ucs_admin_object['name'] = normal_cn
117
	ucs_admin_object.modify()

Return to bug 37388