|
Lines 44-50
Link Here
|
| 44 |
from signal import * |
44 |
from signal import * |
| 45 |
term_signal_caught = False |
45 |
term_signal_caught = False |
| 46 |
|
46 |
|
| 47 |
from univention.s4connector.s4cache import S4Cache |
|
|
| 48 |
import sqlite3 as lite |
47 |
import sqlite3 as lite |
| 49 |
|
48 |
|
| 50 |
univention.admin.modules.update() |
49 |
univention.admin.modules.update() |
|
Lines 314-320
Link Here
|
| 314 |
return self.config.has_key(section) and self.config[section].has_key(option) |
313 |
return self.config.has_key(section) and self.config[section].has_key(option) |
| 315 |
|
314 |
|
| 316 |
class attribute: |
315 |
class attribute: |
| 317 |
def __init__ ( self, ucs_attribute='', ldap_attribute='', con_attribute='', con_other_attribute='', required=0, single_value=False, compare_function=None, mapping=(), reverse_attribute_check=False, sync_mode='sync' ): |
316 |
def __init__ ( self, ucs_attribute='', ldap_attribute='', con_attribute='', con_other_attribute='', required=0, compare_function=None, mapping=(), reverse_attribute_check=False, sync_mode='sync' ): |
| 318 |
self.ucs_attribute=ucs_attribute |
317 |
self.ucs_attribute=ucs_attribute |
| 319 |
self.ldap_attribute=ldap_attribute |
318 |
self.ldap_attribute=ldap_attribute |
| 320 |
self.con_attribute=con_attribute |
319 |
self.con_attribute=con_attribute |
|
Lines 331-337
Link Here
|
| 331 |
# Seee https://forge.univention.org/bugzilla/show_bug.cgi?id=25823 |
330 |
# Seee https://forge.univention.org/bugzilla/show_bug.cgi?id=25823 |
| 332 |
self.reverse_attribute_check=reverse_attribute_check |
331 |
self.reverse_attribute_check=reverse_attribute_check |
| 333 |
self.sync_mode = sync_mode |
332 |
self.sync_mode = sync_mode |
| 334 |
self.single_value=single_value |
|
|
| 335 |
|
333 |
|
| 336 |
class property: |
334 |
class property: |
| 337 |
def __init__( self, ucs_default_dn='', con_default_dn='', ucs_module='', ucs_module_others=[], sync_mode='', scope='', con_search_filter='', ignore_filter=None, match_filter=None, ignore_subtree=[], |
335 |
def __init__( self, ucs_default_dn='', con_default_dn='', ucs_module='', ucs_module_others=[], sync_mode='', scope='', con_search_filter='', ignore_filter=None, match_filter=None, ignore_subtree=[], |
|
Lines 408-416
Link Here
|
| 408 |
configdbfile='/etc/univention/%s/s4internal.sqlite' % self.CONFIGBASENAME |
406 |
configdbfile='/etc/univention/%s/s4internal.sqlite' % self.CONFIGBASENAME |
| 409 |
self.config = configdb(configdbfile) |
407 |
self.config = configdb(configdbfile) |
| 410 |
|
408 |
|
| 411 |
s4cachedbfile='/etc/univention/%s/s4cache.sqlite' % self.CONFIGBASENAME |
|
|
| 412 |
self.s4cache = S4Cache(s4cachedbfile) |
| 413 |
|
| 414 |
configfile='/etc/univention/%s/s4internal.cfg' % self.CONFIGBASENAME |
409 |
configfile='/etc/univention/%s/s4internal.cfg' % self.CONFIGBASENAME |
| 415 |
if os.path.exists(configfile): |
410 |
if os.path.exists(configfile): |
| 416 |
ud.debug(ud.LDAP, ud.PROCESS, "Converting %s into a sqlite database" % configfile) |
411 |
ud.debug(ud.LDAP, ud.PROCESS, "Converting %s into a sqlite database" % configfile) |
|
Lines 429-435
Link Here
|
| 429 |
|
424 |
|
| 430 |
self.open_ucs() |
425 |
self.open_ucs() |
| 431 |
|
426 |
|
| 432 |
for section in ['DN Mapping UCS','DN Mapping CON','UCS rejected', 'UCS deleted']: |
427 |
for section in ['DN Mapping UCS','DN Mapping CON','UCS rejected']: |
| 433 |
if not self.config.has_section(section): |
428 |
if not self.config.has_section(section): |
| 434 |
self.config.add_section(section) |
429 |
self.config.add_section(section) |
| 435 |
|
430 |
|
|
Lines 706-716
Link Here
|
| 706 |
if key: |
701 |
if key: |
| 707 |
break |
702 |
break |
| 708 |
|
703 |
|
| 709 |
entryUUID = new.get('entryUUID')[0] |
|
|
| 710 |
if entryUUID: |
| 711 |
if self.was_entryUUID_deleted(entryUUID): |
| 712 |
ud.debug(ud.LDAP, ud.PROCESS, "__sync_file_from_ucs: Object with entryUUID %s was already deleted. Don't recreate." % entryUUID) |
| 713 |
return True |
| 714 |
#ud.debug(ud.LDAP, ud.INFO, "__sync_file_from_ucs: old: %s" % old) |
704 |
#ud.debug(ud.LDAP, ud.INFO, "__sync_file_from_ucs: old: %s" % old) |
| 715 |
#ud.debug(ud.LDAP, ud.INFO, "__sync_file_from_ucs: new: %s" % new) |
705 |
#ud.debug(ud.LDAP, ud.INFO, "__sync_file_from_ucs: new: %s" % new) |
| 716 |
if old and new: |
706 |
if old and new: |
|
Lines 774-781
Link Here
|
| 774 |
if not self._ignore_object(key,object) or ignore_subtree_match: |
764 |
if not self._ignore_object(key,object) or ignore_subtree_match: |
| 775 |
ud.debug(ud.LDAP, ud.INFO, "__sync_file_from_ucs: finished mapping") |
765 |
ud.debug(ud.LDAP, ud.INFO, "__sync_file_from_ucs: finished mapping") |
| 776 |
try: |
766 |
try: |
| 777 |
if ((old_dn and not self.sync_from_ucs(key, object, premapped_ucs_dn, unicode(old_dn,'utf8'), old, new)) |
767 |
if ((old_dn and not self.sync_from_ucs(key, object, premapped_ucs_dn, unicode(old_dn,'utf8'), old)) |
| 778 |
or (not old_dn and not self.sync_from_ucs(key, object, premapped_ucs_dn, old_dn, old, new))): |
768 |
or (not old_dn and not self.sync_from_ucs(key, object, premapped_ucs_dn, old_dn, old))): |
| 779 |
self._save_rejected_ucs(filename, dn) |
769 |
self._save_rejected_ucs(filename, dn) |
| 780 |
return False |
770 |
return False |
| 781 |
else: |
771 |
else: |
|
Lines 921-926
Link Here
|
| 921 |
# dummy |
911 |
# dummy |
| 922 |
pass |
912 |
pass |
| 923 |
|
913 |
|
|
|
914 |
def _generate_dn_list_from(self, files): |
| 915 |
''' |
| 916 |
Save all filenames in a dictonary with dn as key |
| 917 |
If more than one pickle file was created for one DN we could skip the first one |
| 918 |
''' |
| 919 |
if len(files) > 200: |
| 920 |
# Show an info if it takes some time |
| 921 |
ud.debug(ud.LDAP, ud.PROCESS, 'Scan all changes from UCS ...') |
| 922 |
self.dn_list = {} |
| 923 |
for listener_file in files: |
| 924 |
filename = os.path.join(self.listener_dir, listener_file) |
| 925 |
if not filename == "%s/tmp" % self.baseConfig['%s/s4/listener/dir' % self.CONFIGBASENAME]: |
| 926 |
if not filename in self.rejected_files: |
| 927 |
try: |
| 928 |
f=file(filename,'r') |
| 929 |
except IOError: # file not found so there's nothing to sync |
| 930 |
continue |
| 931 |
|
| 932 |
dn,new,old,old_dn=cPickle.load(f) |
| 933 |
if not self.dn_list.get(dn): |
| 934 |
self.dn_list[dn]=[filename] |
| 935 |
else: |
| 936 |
self.dn_list[dn].append(filename) |
| 937 |
|
| 924 |
def poll_ucs(self): |
938 |
def poll_ucs(self): |
| 925 |
''' |
939 |
''' |
| 926 |
poll changes from UCS: iterates over files exported by directory-listener module |
940 |
poll changes from UCS: iterates over files exported by directory-listener module |
|
Lines 945-950
Link Here
|
| 945 |
# the change list is too long and it took too much time |
959 |
# the change list is too long and it took too much time |
| 946 |
files = files[:MAX_SYNC_IN_ONE_INTERVAL] |
960 |
files = files[:MAX_SYNC_IN_ONE_INTERVAL] |
| 947 |
|
961 |
|
|
|
962 |
# Create a dictonary with all DNs |
| 963 |
self._generate_dn_list_from(files) |
| 964 |
|
| 948 |
# We may dropped the parent object, so don't show the traceback in any case |
965 |
# We may dropped the parent object, so don't show the traceback in any case |
| 949 |
traceback_level = ud.WARN |
966 |
traceback_level = ud.WARN |
| 950 |
|
967 |
|
|
Lines 956-983
Link Here
|
| 956 |
try: |
973 |
try: |
| 957 |
f=file(filename,'r') |
974 |
f=file(filename,'r') |
| 958 |
except IOError: # file not found so there's nothing to sync |
975 |
except IOError: # file not found so there's nothing to sync |
|
|
976 |
if self.dn_list.get(dn): |
| 977 |
self.dn_list[dn].remove(filename) |
| 959 |
continue |
978 |
continue |
| 960 |
|
979 |
|
| 961 |
dn,new,old,old_dn=cPickle.load(f) |
980 |
dn,new,old,old_dn=cPickle.load(f) |
| 962 |
|
981 |
|
| 963 |
for i in [0, 1]: # do it twice if the LDAP connection was closed |
982 |
if len(self.dn_list.get(dn, [])) < 2 or not old or not new: |
|
|
983 |
# If the list contains more then one file, the DN will be synced later |
| 984 |
# But if the object was added or remoed, the synchonization is required |
| 985 |
for i in [0, 1]: # do it twice if the LDAP connection was closed |
| 986 |
try: |
| 987 |
sync_successfull = self.__sync_file_from_ucs(filename, traceback_level=traceback_level) |
| 988 |
except (ldap.SERVER_DOWN, SystemExit): |
| 989 |
# once again, ldap idletimeout ... |
| 990 |
if i == 0: |
| 991 |
self.open_ucs() |
| 992 |
continue |
| 993 |
raise |
| 994 |
except: |
| 995 |
self._save_rejected_ucs(filename, dn) |
| 996 |
# We may dropped the parent object, so don't show this warning |
| 997 |
self._debug_traceback(traceback_level, "sync failed, saved as rejected \n\t%s" % filename) |
| 998 |
if sync_successfull: |
| 999 |
os.remove(os.path.join(self.listener_dir,listener_file)) |
| 1000 |
change_counter += 1 |
| 1001 |
break |
| 1002 |
else: |
| 1003 |
os.remove(os.path.join(filename)) |
| 1004 |
traceback_level = ud.INFO |
| 964 |
try: |
1005 |
try: |
| 965 |
sync_successfull = self.__sync_file_from_ucs(filename, traceback_level=traceback_level) |
1006 |
ud.debug(ud.LDAP, ud.PROCESS, 'Drop %s. The DN %s will synced later' % (filename, dn)) |
| 966 |
except (ldap.SERVER_DOWN, SystemExit): |
|
|
| 967 |
# once again, ldap idletimeout ... |
| 968 |
if i == 0: |
| 969 |
self.open_ucs() |
| 970 |
continue |
| 971 |
raise |
| 972 |
except: |
1007 |
except: |
| 973 |
self._save_rejected_ucs(filename, dn) |
1008 |
ud.debug(ud.LDAP, ud.PROCESS, 'Drop %s. The object will synced later' % (filename)) |
| 974 |
# We may dropped the parent object, so don't show this warning |
|
|
| 975 |
self._debug_traceback(traceback_level, "sync failed, saved as rejected \n\t%s" % filename) |
| 976 |
if sync_successfull: |
| 977 |
os.remove(os.path.join(self.listener_dir,listener_file)) |
| 978 |
change_counter += 1 |
| 979 |
break |
| 980 |
|
1009 |
|
|
|
1010 |
if self.dn_list.get(dn): |
| 1011 |
self.dn_list[dn].remove(filename) |
| 1012 |
|
| 981 |
done_counter += 1 |
1013 |
done_counter += 1 |
| 982 |
print "%s"%done_counter, |
1014 |
print "%s"%done_counter, |
| 983 |
sys.stdout.flush() |
1015 |
sys.stdout.flush() |
|
Lines 1002-1008
Link Here
|
| 1002 |
_d=ud.function('ldap.__set_value') |
1034 |
_d=ud.function('ldap.__set_value') |
| 1003 |
if not modtype == 'add': |
1035 |
if not modtype == 'add': |
| 1004 |
ucs_object.open() |
1036 |
ucs_object.open() |
| 1005 |
ud.debug(ud.LDAP, ud.INFO, '__set_values: object: %s' % object) |
|
|
| 1006 |
def set_values(attributes): |
1037 |
def set_values(attributes): |
| 1007 |
if object['attributes'].has_key(attributes.ldap_attribute): |
1038 |
if object['attributes'].has_key(attributes.ldap_attribute): |
| 1008 |
ucs_key = attributes.ucs_attribute |
1039 |
ucs_key = attributes.ucs_attribute |
|
Lines 1058-1067
Link Here
|
| 1058 |
else: |
1089 |
else: |
| 1059 |
equal = compare[0] == compare[1] |
1090 |
equal = compare[0] == compare[1] |
| 1060 |
if not equal: |
1091 |
if not equal: |
| 1061 |
if isinstance(value, list): |
1092 |
ucs_object[ucs_key] = value |
| 1062 |
ucs_object[ucs_key] = list(set(value)) |
|
|
| 1063 |
else: |
| 1064 |
ucs_object[ucs_key] = value |
| 1065 |
ud.debug(ud.LDAP, ud.INFO, |
1093 |
ud.debug(ud.LDAP, ud.INFO, |
| 1066 |
"set key in ucs-object: %s" % ucs_key) |
1094 |
"set key in ucs-object: %s" % ucs_key) |
| 1067 |
else: |
1095 |
else: |
|
Lines 1096-1113
Link Here
|
| 1096 |
else: |
1124 |
else: |
| 1097 |
ud.debug(ud.LDAP, ud.WARN, '__set_values: The attributes for %s have not been removed as it represents a mandatory attribute' % ucs_key) |
1125 |
ud.debug(ud.LDAP, ud.WARN, '__set_values: The attributes for %s have not been removed as it represents a mandatory attribute' % ucs_key) |
| 1098 |
|
1126 |
|
|
|
1127 |
|
| 1099 |
for attr_key in self.property[property_type].attributes.keys(): |
1128 |
for attr_key in self.property[property_type].attributes.keys(): |
| 1100 |
if self.property[property_type].attributes[attr_key].sync_mode in ['read', 'sync']: |
1129 |
if self.property[property_type].attributes[attr_key].sync_mode in ['read', 'sync']: |
|
|
1130 |
set_values(self.property[property_type].attributes[attr_key]) |
| 1101 |
|
1131 |
|
| 1102 |
con_attribute = self.property[property_type].attributes[attr_key].con_attribute |
|
|
| 1103 |
con_other_attribute = self.property[property_type].attributes[attr_key].con_other_attribute |
| 1104 |
|
| 1105 |
if not object.get('changed_attributes') or con_attribute in object.get('changed_attributes') or (con_other_attribute and con_other_attribute in object.get('changed_attributes')): |
| 1106 |
ud.debug(ud.LDAP, ud.INFO, '__set_values: Set: %s' % con_attribute) |
| 1107 |
set_values(self.property[property_type].attributes[attr_key]) |
| 1108 |
else: |
| 1109 |
ud.debug(ud.LDAP, ud.INFO, '__set_values: Skip: %s' % con_attribute) |
| 1110 |
|
| 1111 |
# post-values |
1132 |
# post-values |
| 1112 |
if not self.property[property_type].post_attributes: |
1133 |
if not self.property[property_type].post_attributes: |
| 1113 |
return |
1134 |
return |
|
Lines 1118-1138
Link Here
|
| 1118 |
set_values(self.property[property_type].post_attributes[attr_key].mapping[1](self, property_type, object)) |
1139 |
set_values(self.property[property_type].post_attributes[attr_key].mapping[1](self, property_type, object)) |
| 1119 |
else: |
1140 |
else: |
| 1120 |
if self.property[property_type].post_attributes[attr_key].sync_mode in ['read', 'sync']: |
1141 |
if self.property[property_type].post_attributes[attr_key].sync_mode in ['read', 'sync']: |
| 1121 |
|
1142 |
if self.property[property_type].post_attributes[attr_key].reverse_attribute_check: |
| 1122 |
con_attribute = self.property[property_type].post_attributes[attr_key].con_attribute |
1143 |
if object['attributes'].get(self.property[property_type].post_attributes[attr_key].ldap_attribute): |
| 1123 |
con_other_attribute = self.property[property_type].post_attributes[attr_key].con_other_attribute |
1144 |
set_values(self.property[property_type].post_attributes[attr_key]) |
| 1124 |
|
|
|
| 1125 |
if not object.get('changed_attributes') or con_attribute in object.get('changed_attributes') or (con_other_attribute and con_other_attribute in object.get('changed_attributes')): |
| 1126 |
ud.debug(ud.LDAP, ud.INFO, '__set_values: Set: %s' % con_attribute) |
| 1127 |
if self.property[property_type].post_attributes[attr_key].reverse_attribute_check: |
| 1128 |
if object['attributes'].get(self.property[property_type].post_attributes[attr_key].ldap_attribute): |
| 1129 |
set_values(self.property[property_type].post_attributes[attr_key]) |
| 1130 |
else: |
| 1131 |
ucs_object[self.property[property_type].post_attributes[attr_key].ucs_attribute] = '' |
| 1132 |
else: |
1145 |
else: |
| 1133 |
set_values(self.property[property_type].post_attributes[attr_key]) |
1146 |
ucs_object[self.property[property_type].post_attributes[attr_key].ucs_attribute] = '' |
| 1134 |
else: |
1147 |
else: |
| 1135 |
ud.debug(ud.LDAP, ud.INFO, '__set_values: Skip: %s' % con_attribute) |
1148 |
set_values(self.property[property_type].post_attributes[attr_key]) |
| 1136 |
|
1149 |
|
| 1137 |
def __modify_custom_attributes(self, property_type, object, ucs_object, module, position, modtype = "modify"): |
1150 |
def __modify_custom_attributes(self, property_type, object, ucs_object, module, position, modtype = "modify"): |
| 1138 |
if object.has_key('custom_attributes'): |
1151 |
if object.has_key('custom_attributes'): |
|
Lines 1207-1239
Link Here
|
| 1207 |
ucs_object.move(object['dn']) |
1220 |
ucs_object.move(object['dn']) |
| 1208 |
return True |
1221 |
return True |
| 1209 |
|
1222 |
|
| 1210 |
def _get_entryUUID(self, dn): |
|
|
| 1211 |
try: |
| 1212 |
result = self.search_ucs(base=dn, scope='base', attr=['entryUUID'], unique=True) |
| 1213 |
if result: |
| 1214 |
return result[0][1].get('entryUUID')[0] |
| 1215 |
else: |
| 1216 |
return None |
| 1217 |
except univention.admin.uexceptions.noObject: |
| 1218 |
return None |
| 1219 |
|
| 1220 |
def update_deleted_cache_after_removal_in_ucs(self, entryUUID, objectGUID): |
| 1221 |
if not entryUUID: |
| 1222 |
return |
| 1223 |
# use a dummy value |
| 1224 |
if not objectGUID: |
| 1225 |
objectGUID='objectGUID' |
| 1226 |
ud.debug(ud.LDAP, ud.INFO, "update_deleted_cache_after_removal_in_ucs: Save entryUUID %s as deleted to UCS deleted cache. ObjectGUUID: %s" % (entryUUID, objectGUID)) |
| 1227 |
self._set_config_option('UCS deleted', entryUUID, base64.encodestring(objectGUID)) |
| 1228 |
|
| 1229 |
def was_entryUUID_deleted(self, entryUUID): |
| 1230 |
objectGUID = self.config.get('UCS deleted', entryUUID) |
| 1231 |
if objectGUID: |
| 1232 |
return True |
| 1233 |
else: |
| 1234 |
return False |
| 1235 |
|
| 1236 |
|
| 1237 |
def delete_in_ucs(self, property_type, object, module, position): |
1223 |
def delete_in_ucs(self, property_type, object, module, position): |
| 1238 |
_d=ud.function('ldap.delete_in_ucs') |
1224 |
_d=ud.function('ldap.delete_in_ucs') |
| 1239 |
|
1225 |
|
|
Lines 1241-1249
Link Here
|
| 1241 |
ud.debug(ud.LDAP, ud.PROCESS, "Delete of %s was disabled in mapping" % object['dn']) |
1227 |
ud.debug(ud.LDAP, ud.PROCESS, "Delete of %s was disabled in mapping" % object['dn']) |
| 1242 |
return True |
1228 |
return True |
| 1243 |
|
1229 |
|
| 1244 |
objectGUID = object['attributes'].get('objectGUID')[0] |
|
|
| 1245 |
entryUUID = self._get_entryUUID(object['dn']) |
| 1246 |
|
| 1247 |
module = self.modules[property_type] |
1230 |
module = self.modules[property_type] |
| 1248 |
ucs_object = univention.admin.objects.get(module, None, self.lo, dn=object['dn'], position='') |
1231 |
ucs_object = univention.admin.objects.get(module, None, self.lo, dn=object['dn'], position='') |
| 1249 |
|
1232 |
|
|
Lines 1250-1256
Link Here
|
| 1250 |
try: |
1233 |
try: |
| 1251 |
ucs_object.open() |
1234 |
ucs_object.open() |
| 1252 |
ucs_object.remove() |
1235 |
ucs_object.remove() |
| 1253 |
self. update_deleted_cache_after_removal_in_ucs(entryUUID, objectGUID) |
|
|
| 1254 |
return True |
1236 |
return True |
| 1255 |
except Exception, e: |
1237 |
except Exception, e: |
| 1256 |
ud.debug(ud.LDAP, ud.INFO,"delete object exception: %s"%e) |
1238 |
ud.debug(ud.LDAP, ud.INFO,"delete object exception: %s"%e) |
|
Lines 1285-1291
Link Here
|
| 1285 |
else: |
1267 |
else: |
| 1286 |
raise |
1268 |
raise |
| 1287 |
|
1269 |
|
| 1288 |
def sync_to_ucs(self, property_type, object, premapped_s4_dn, original_object): |
1270 |
def sync_to_ucs(self, property_type, object, premapped_s4_dn): |
| 1289 |
_d=ud.function('ldap.sync_to_ucs') |
1271 |
_d=ud.function('ldap.sync_to_ucs') |
| 1290 |
# this function gets an object from the s4 class, which should be converted into a ucs modul |
1272 |
# this function gets an object from the s4 class, which should be converted into a ucs modul |
| 1291 |
|
1273 |
|
|
Lines 1329-1353
Link Here
|
| 1329 |
pass |
1311 |
pass |
| 1330 |
|
1312 |
|
| 1331 |
try: |
1313 |
try: |
| 1332 |
guid = original_object.get('attributes').get('objectGUID')[0] |
|
|
| 1333 |
|
| 1334 |
object['changed_attributes'] = [] |
| 1335 |
if object['modtype'] == 'modify' and original_object: |
| 1336 |
old_s4_object = self.s4cache.get_entry(guid) |
| 1337 |
ud.debug(ud.LDAP, ud.INFO, "sync_to_ucs: old_s4_object: %s" % old_s4_object) |
| 1338 |
ud.debug(ud.LDAP, ud.INFO, "sync_to_ucs: new_s4_object: %s" % original_object['attributes']) |
| 1339 |
if old_s4_object: |
| 1340 |
for attr in original_object['attributes']: |
| 1341 |
if old_s4_object.get(attr) != original_object['attributes'].get(attr): |
| 1342 |
object['changed_attributes'].append(attr) |
| 1343 |
for attr in old_s4_object: |
| 1344 |
if old_s4_object.get(attr) != original_object['attributes'].get(attr): |
| 1345 |
if not attr in object['changed_attributes']: |
| 1346 |
object['changed_attributes'].append(attr) |
| 1347 |
else: |
| 1348 |
object['changed_attributes'] = original_object['attributes'].keys() |
| 1349 |
ud.debug(ud.LDAP, ud.INFO, "The following attributes have been changed: %s" % object['changed_attributes']) |
| 1350 |
|
| 1351 |
result = False |
1314 |
result = False |
| 1352 |
if hasattr(self.property[property_type],"ucs_sync_function"): |
1315 |
if hasattr(self.property[property_type],"ucs_sync_function"): |
| 1353 |
result = self.property[property_type].ucs_sync_function(self, property_type, object) |
1316 |
result = self.property[property_type].ucs_sync_function(self, property_type, object) |
|
Lines 1355-1361
Link Here
|
| 1355 |
if object['modtype'] == 'add': |
1318 |
if object['modtype'] == 'add': |
| 1356 |
result = self.add_in_ucs(property_type, object, module, position) |
1319 |
result = self.add_in_ucs(property_type, object, module, position) |
| 1357 |
self._check_dn_mapping(object['dn'], premapped_s4_dn) |
1320 |
self._check_dn_mapping(object['dn'], premapped_s4_dn) |
| 1358 |
self.s4cache.add_entry(guid, original_object.get('attributes')) |
|
|
| 1359 |
if object['modtype'] == 'delete': |
1321 |
if object['modtype'] == 'delete': |
| 1360 |
if not old_object: |
1322 |
if not old_object: |
| 1361 |
ud.debug(ud.LDAP, ud.WARN, |
1323 |
ud.debug(ud.LDAP, ud.WARN, |
|
Lines 1364-1380
Link Here
|
| 1364 |
else: |
1326 |
else: |
| 1365 |
result = self.delete_in_ucs(property_type, object, module, position) |
1327 |
result = self.delete_in_ucs(property_type, object, module, position) |
| 1366 |
self._remove_dn_mapping(object['dn'], premapped_s4_dn) |
1328 |
self._remove_dn_mapping(object['dn'], premapped_s4_dn) |
| 1367 |
self.s4cache.remove_entry(guid) |
|
|
| 1368 |
if object['modtype'] == 'move': |
1329 |
if object['modtype'] == 'move': |
| 1369 |
result = self.move_in_ucs(property_type, object, module, position) |
1330 |
result = self.move_in_ucs(property_type, object, module, position) |
| 1370 |
self._remove_dn_mapping(object['olddn'], '') # we don't know the old s4-dn here anymore, will be checked by remove_dn_mapping |
1331 |
self._remove_dn_mapping(object['olddn'], '') # we don't know the old s4-dn here anymore, will be checked by remove_dn_mapping |
| 1371 |
self._check_dn_mapping(object['dn'], premapped_s4_dn) |
1332 |
self._check_dn_mapping(object['dn'], premapped_s4_dn) |
| 1372 |
# Check S4cache |
|
|
| 1373 |
|
1333 |
|
| 1374 |
if object['modtype'] == 'modify': |
1334 |
if object['modtype'] == 'modify': |
| 1375 |
result = self.modify_in_ucs(property_type, object, module, position) |
1335 |
result = self.modify_in_ucs(property_type, object, module, position) |
| 1376 |
self._check_dn_mapping(object['dn'], premapped_s4_dn) |
1336 |
self._check_dn_mapping(object['dn'], premapped_s4_dn) |
| 1377 |
self.s4cache.add_entry(guid, original_object.get('attributes')) |
|
|
| 1378 |
|
1337 |
|
| 1379 |
if not result: |
1338 |
if not result: |
| 1380 |
ud.debug(ud.LDAP, ud.WARN, |
1339 |
ud.debug(ud.LDAP, ud.WARN, |
|
Lines 1413-1419
Link Here
|
| 1413 |
self._debug_traceback(ud.ERROR, "Unknown Exception during sync_to_ucs") |
1372 |
self._debug_traceback(ud.ERROR, "Unknown Exception during sync_to_ucs") |
| 1414 |
return False |
1373 |
return False |
| 1415 |
|
1374 |
|
| 1416 |
def sync_from_ucs(self, property_type, object, pre_mapped_ucs_dn, old_dn=None, old_ucs_object = None, new_ucs_object = None): |
1375 |
def sync_from_ucs(self, property_type, object, old_dn=None): |
| 1417 |
# dummy |
1376 |
# dummy |
| 1418 |
return False |
1377 |
return False |
| 1419 |
|
1378 |
|