diff --git a/gestion/dialog/adherent.py b/gestion/dialog/adherent.py index 5d71bb2c..3f705205 100644 --- a/gestion/dialog/adherent.py +++ b/gestion/dialog/adherent.py @@ -212,6 +212,7 @@ class Dialog(proprio.Dialog): adherent["controle"]=unicode(adherent["controle"][0]).replace('c','') if not adherent["controle"][0]: adherent["controle"] = [] + adherent.validate_changes() adherent.history_gen() adherent.save() # On s'en va en mettant à jour dans la continuation la valeur de obj @@ -391,6 +392,7 @@ class Dialog(proprio.Dialog): text_bottom=u"\nPasser la chambre de cet adhérent en chambre inconnue ?" ): squatteur['chbre']=u'????' + squatteur.validate_changes() squatteur.history_gen() squatteur.save() return True @@ -419,6 +421,7 @@ class Dialog(proprio.Dialog): else: with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent: adherent = set_chambre(adherent, chbre) + adherent.validate_changes() adherent.history_gen() adherent.save() self.display_item(item=adherent, title="Adhérent déménagé dans la chambre %s" % output) @@ -458,6 +461,7 @@ class Dialog(proprio.Dialog): with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent: adherent['postalAddress']=[unicode(pa, 'utf-8') for pa in output] adherent['chbre']=u'EXT' + adherent.validate_changes() adherent.history_gen() adherent.save() self.display_item(item=adherent, title="Adhérent déménégé hors campus, machines conservées") @@ -485,6 +489,7 @@ class Dialog(proprio.Dialog): with machine: machine.delete() adherent['chbre']=u'EXT' + adherent.validate_changes() adherent.history_gen() adherent.save() self.display_item(item=adherent, title="Adhérent déménégé hors campus, machines supprimées") @@ -513,6 +518,7 @@ class Dialog(proprio.Dialog): with machine: machine.delete() adherent['chbre']=u'EXT' + adherent.validate_changes() adherent.history_gen() adherent.save() # On supprime le compte crans (on essaye) @@ -638,6 +644,7 @@ class Dialog(proprio.Dialog): # Les vérifications de sécurité sont faites dans lc_ldap with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent: adherent['droits']=[unicode(d) for d in droits] + adherent.validate_changes() adherent.history_gen() adherent.save() if adherent["uid"] and adherent["uid"][0] == self.conn.current_login: @@ -863,6 +870,7 @@ class Dialog(proprio.Dialog): if not adherent["etudes"] or adherent["etudes"][0] != etablissement or adherent["etudes"][1] != annee or adherent["etudes"][2] != section: with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent: adherent["etudes"]=[unicode(etablissement), unicode(annee), unicode(section)] + adherent.validate_changes() adherent.history_gen() adherent.save() raise Continue(cont(adherent=adherent)) diff --git a/gestion/dialog/blacklist.py b/gestion/dialog/blacklist.py index 61746d76..83f75a48 100644 --- a/gestion/dialog/blacklist.py +++ b/gestion/dialog/blacklist.py @@ -157,6 +157,7 @@ class Dialog(lc.Dialog): try: with self.conn.search(dn=obj.dn, scope=0, mode='rw')[0] as obj: obj['blacklist'].append(bl) + obj.validate_changes() obj.history_gen() obj.save() # On s'en va en mettant à jour dans la continuation la valeur de obj @@ -212,6 +213,7 @@ class Dialog(lc.Dialog): try: with self.conn.search(dn=obj.dn, scope=0, mode='rw')[0] as obj: obj['blacklist'][int(tag)]=bl + obj.validate_changes() obj.history_gen() obj.save() # On s'en va en mettant à jour dans la continuation la valeur de obj diff --git a/gestion/dialog/certificat.py b/gestion/dialog/certificat.py index 15b11317..8ade7974 100644 --- a/gestion/dialog/certificat.py +++ b/gestion/dialog/certificat.py @@ -78,6 +78,7 @@ les valeurs valident sont : certificat.tlsa(values['certificatUsage'], values['matchingType']) certificat['portTCPin'] = [unicode(s, 'utf-8') for s in values['portTCPin'].split(separateur) if s] certificat['portUDPin'] = [unicode(s, 'utf-8') for s in values['portUDPin'].split(separateur) if s] + certificat.validate_changes() certificat.history_gen() certificat.save() raise Continue(cont(certificat=certificat)) @@ -118,6 +119,7 @@ les valeurs valident sont : if certificat: with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat: certificat['certificat'] = unicode(pem.strip(), 'utf-8') + certificat.validate_changes() certificat.history_gen() certificat.save() else: @@ -182,6 +184,7 @@ les valeurs valident sont : raise ValueError("Il y a déjà une clef privée, merci d'annuler") with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat: certificat.private(pem, encrypted=True) + certificat.validate_changes() certificat.history_gen() certificat.save() self.dialog.msgbox("Clef privée bien ajouté", timeout=self.timeout, title="Ajout d'une clef privée") @@ -267,6 +270,7 @@ les valeurs valident sont : csr = crypto.dump_certificate_request(crypto.FILETYPE_PEM, req) with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat: certificat['csr']=unicode(csr) + certificat.validate_changes() certificat.history_gen() certificat.save() self.handle_dialog(cont, box, csr) @@ -328,6 +332,7 @@ les valeurs valident sont : if certificat: with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat: certificat['csr'] = unicode(pem.strip(), 'utf-8') + certificat.validate_changes() certificat.history_gen() certificat.save() else: diff --git a/gestion/dialog/lc.py b/gestion/dialog/lc.py index bb7fb958..1463970c 100644 --- a/gestion/dialog/lc.py +++ b/gestion/dialog/lc.py @@ -129,6 +129,7 @@ class Dialog(CPS.Dialog): obj[a.ldap_name]=values[a.ldap_name] elif not obj[a.ldap_name] and missing.get(a, missing['default']) != values[a.ldap_name]: obj[a.ldap_name]=values[a.ldap_name] + obj.validate_changes() obj.history_gen() obj.save() # On s'en va en mettant à jour dans la continuation la valeur de obj @@ -187,6 +188,7 @@ class Dialog(CPS.Dialog): def todo(obj, values, cont): with self.conn.search(dn=obj.dn, scope=0, mode='rw')[0] as obj: obj[attr] = [unicode(value, 'utf-8') for value in values] + obj.validate_changes() obj.history_gen() obj.save() raise Continue(cont(**{update_obj:obj})) diff --git a/gestion/dialog/proprio.py b/gestion/dialog/proprio.py index 73fbaf1d..636cf438 100644 --- a/gestion/dialog/proprio.py +++ b/gestion/dialog/proprio.py @@ -112,6 +112,7 @@ class Dialog(machine.Dialog, blacklist.Dialog): if not self.confirm_item(item=proprio, title="Création du compte crans pour l'adhérent ?"): raise Continue(cont) else: + proprio.validate_changes() proprio.history_gen() proprio.save() self.dialog.msgbox( @@ -156,6 +157,7 @@ class Dialog(machine.Dialog, blacklist.Dialog): else: with self.conn.search(dn=proprio.dn, scope=0, mode='rw')[0] as proprio: proprio['userPassword']=unicode(lc_utils.hash_password(password)) + proprio.validate_changes() proprio.history_gen() proprio.save() self.dialog.msgbox( @@ -191,6 +193,7 @@ class Dialog(machine.Dialog, blacklist.Dialog): raise ValueError("Il faut entrer une adresse mail") with self.conn.search(dn=proprio.dn, scope=0, mode='rw')[0] as proprio: proprio.delete_compte(unicode(mail, 'utf-8')) + proprio.validate_changes() proprio.history_gen() proprio.save() self.dialog.msgbox("Le compte a bien été supprimée", timeout=self.timeout, title="Suppression du compte de %s %s" % (proprio.get('prenom', [''])[0], proprio["nom"][0])) @@ -214,6 +217,7 @@ class Dialog(machine.Dialog, blacklist.Dialog): proprio["shadowExpire"]=0 else: proprio["shadowExpire"]=[] + proprio.validate_changes() proprio.history_gen() proprio.save() raise Continue(cont(proprio=proprio)) @@ -256,6 +260,7 @@ class Dialog(machine.Dialog, blacklist.Dialog): if shell and shell != output: with self.conn.search(dn=proprio.dn, scope=0, mode='rw')[0] as proprio: proprio['loginShell']=unicode(loginShell) + proprio.validate_changes() proprio.history_gen() proprio.save() self.dialog.msgbox("Shell modifié avec succès.\nLa modification peut prendre une quainzaine de minute avant d'être effective.",