|
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() |