|
1266 |
function(self, property_type, ucs_object) |
1254 |
function(self, property_type, ucs_object) |
1267 |
return ucs_object.create() and self.__modify_custom_attributes(property_type, object, ucs_object, module, position) |
1255 |
return ucs_object.create() and self.__modify_custom_attributes(property_type, object, ucs_object, module, position) |
1268 |
|
1256 |
|
1269 |
def modify_in_ucs(self, property_type, object, module, position): |
1257 |
def modify_in_ucs(self, property_type, object, module, position): |
1270 |
_d = ud.function('ldap.modify_in_ucs') |
1258 |
_d = ud.function('ldap.modify_in_ucs') |
1271 |
module = self.modules[property_type] |
|
|
1272 |
|
1259 |
|
1273 |
if 'olddn' in object: |
1260 |
if 'olddn' in object: |
1274 |
dntype = 'olddn' |
1261 |
dntype = 'olddn' |
|
1275 |
else: |
1262 |
else: |
1276 |
dntype = 'dn' |
1263 |
dntype = 'dn' |
1277 |
|
1264 |
|
1278 |
ucs_object_dn = object[dntype] |
1265 |
if self.modules_others[property_type]: |
|
|
1266 |
ucs_object_dn = object[dntype] |
1267 |
ldap_object_ucs = self.get_ucs_ldap_object(ucs_object_dn) |
1268 |
if not module.identify(ucs_object_dn, ldap_object_ucs): |
1269 |
for m in self.modules_others[property_type]: |
1270 |
if m and m.identify(ucs_object_dn, ldap_object_ucs): |
1271 |
module = m |
1272 |
ud.debug(ud.LDAP, ud.INFO, "Mapping to other module: %r" % (module,)) |
1273 |
break |
1274 |
else: |
1275 |
ud.debug(ud.LDAP, ud.ERROR, "Could not identify UDM module for: %s dn: %s" % (property_type, ucs_object_dn)) |
1276 |
return False |
1277 |
|
1279 |
ucs_object = univention.admin.objects.get(module, None, self.lo, dn=ucs_object_dn, position='') |
1278 |
ucs_object = univention.admin.objects.get(module, None, self.lo, dn=ucs_object_dn, position='') |
1280 |
self.__set_values(property_type, object, ucs_object) |
1279 |
self.__set_values(property_type, object, ucs_object) |
1281 |
return ucs_object.modify() and self.__modify_custom_attributes(property_type, object, ucs_object, module, position) |
1280 |
return ucs_object.modify() and self.__modify_custom_attributes(property_type, object, ucs_object, module, position) |
1282 |
|
1281 |
|
1283 |
def move_in_ucs(self, property_type, object, module, position): |
1282 |
def move_in_ucs(self, property_type, object, module, position): |
1284 |
_d = ud.function('ldap.move_in_ucs') |
1283 |
_d = ud.function('ldap.move_in_ucs') |
1285 |
module = self.modules[property_type] |
|
|
1286 |
try: |
1284 |
try: |
1287 |
if object['olddn'].lower() == object['dn'].lower(): |
1285 |
if object['olddn'].lower() == object['dn'].lower(): |
1288 |
ud.debug(ud.LDAP, ud.WARN, "move_in_ucs: cancel move, old and new dn are the same ( %s to %s)" % (object['olddn'], object['dn'])) |
1286 |
ud.debug(ud.LDAP, ud.WARN, "move_in_ucs: cancel move, old and new dn are the same ( %s to %s)" % (object['olddn'], object['dn'])) |
|
1294 |
except: # FIXME: which exception is to be caught? |
1292 |
except: # FIXME: which exception is to be caught? |
1295 |
ud.debug(ud.LDAP, ud.INFO, "move_in_ucs: move object in UCS") |
1293 |
ud.debug(ud.LDAP, ud.INFO, "move_in_ucs: move object in UCS") |
1296 |
|
1294 |
|
|
|
1295 |
if self.modules_others[property_type]: |
1296 |
ucs_object_dn = object['dn'] |
1297 |
ldap_object_ucs = self.get_ucs_ldap_object(ucs_object_dn) |
1298 |
if not module.identify(ucs_object_dn, ldap_object_ucs): |
1299 |
for m in self.modules_others[property_type]: |
1300 |
if m and m.identify(ucs_object_dn, ldap_object_ucs): |
1301 |
module = m |
1302 |
ud.debug(ud.LDAP, ud.INFO, "Mapping to other module: %r" % (module,)) |
1303 |
break |
1304 |
else: |
1305 |
ud.debug(ud.LDAP, ud.ERROR, "Could not identify UDM module for: %s dn: %s" % (property_type, ucs_object_dn)) |
1306 |
return False |
1307 |
|
1297 |
ucs_object = univention.admin.objects.get(module, None, self.lo, dn=object['olddn'], position='') |
1308 |
ucs_object = univention.admin.objects.get(module, None, self.lo, dn=object['olddn'], position='') |
1298 |
ucs_object.open() |
1309 |
ucs_object.open() |
1299 |
ucs_object.move(object['dn']) |
1310 |
ucs_object.move(object['dn']) |
|
1356 |
ud.debug(ud.LDAP, ud.PROCESS, "The windows computer %s is a Domain Controller in OpenLDAP. The deletion will be skipped." % object['dn']) |
1367 |
ud.debug(ud.LDAP, ud.PROCESS, "The windows computer %s is a Domain Controller in OpenLDAP. The deletion will be skipped." % object['dn']) |
1357 |
return True |
1368 |
return True |
1358 |
|
1369 |
|
1359 |
module = self.modules[property_type] |
1370 |
if self.modules_others[property_type]: |
|
|
1371 |
ucs_object_dn = object['dn'] |
1372 |
ldap_object_ucs = self.get_ucs_ldap_object(ucs_object_dn) |
1373 |
if not module.identify(ucs_object_dn, ldap_object_ucs): |
1374 |
for m in self.modules_others[property_type]: |
1375 |
if m and m.identify(ucs_object_dn, ldap_object_ucs): |
1376 |
module = m |
1377 |
ud.debug(ud.LDAP, ud.INFO, "Mapping to other module: %r" % (module,)) |
1378 |
break |
1379 |
else: |
1380 |
ud.debug(ud.LDAP, ud.ERROR, "Could not identify UDM module for: %s dn: %s" % (property_type, ucs_object_dn)) |
1381 |
return False |
1382 |
|
1360 |
ucs_object = univention.admin.objects.get(module, None, self.lo, dn=object['dn'], position='') |
1383 |
ucs_object = univention.admin.objects.get(module, None, self.lo, dn=object['dn'], position='') |
1361 |
|
1384 |
|
1362 |
try: |
1385 |
try: |