[gest_crans_lc] Ajout des validate_changes() même là où ça sert à rien
Pour ne pas avoir de surprise si quelqu'un modifie validate_changes() dans lc_ldap.
This commit is contained in:
parent
f53fd86fba
commit
acd7d8fd7f
5 changed files with 22 additions and 0 deletions
|
@ -212,6 +212,7 @@ class Dialog(proprio.Dialog):
|
||||||
adherent["controle"]=unicode(adherent["controle"][0]).replace('c','')
|
adherent["controle"]=unicode(adherent["controle"][0]).replace('c','')
|
||||||
if not adherent["controle"][0]:
|
if not adherent["controle"][0]:
|
||||||
adherent["controle"] = []
|
adherent["controle"] = []
|
||||||
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
# On s'en va en mettant à jour dans la continuation la valeur de obj
|
# 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 ?"
|
text_bottom=u"\nPasser la chambre de cet adhérent en chambre inconnue ?"
|
||||||
):
|
):
|
||||||
squatteur['chbre']=u'????'
|
squatteur['chbre']=u'????'
|
||||||
|
squatteur.validate_changes()
|
||||||
squatteur.history_gen()
|
squatteur.history_gen()
|
||||||
squatteur.save()
|
squatteur.save()
|
||||||
return True
|
return True
|
||||||
|
@ -419,6 +421,7 @@ class Dialog(proprio.Dialog):
|
||||||
else:
|
else:
|
||||||
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
||||||
adherent = set_chambre(adherent, chbre)
|
adherent = set_chambre(adherent, chbre)
|
||||||
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
self.display_item(item=adherent, title="Adhérent déménagé dans la chambre %s" % output)
|
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:
|
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['postalAddress']=[unicode(pa, 'utf-8') for pa in output]
|
||||||
adherent['chbre']=u'EXT'
|
adherent['chbre']=u'EXT'
|
||||||
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
self.display_item(item=adherent, title="Adhérent déménégé hors campus, machines conservées")
|
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:
|
with machine:
|
||||||
machine.delete()
|
machine.delete()
|
||||||
adherent['chbre']=u'EXT'
|
adherent['chbre']=u'EXT'
|
||||||
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
self.display_item(item=adherent, title="Adhérent déménégé hors campus, machines supprimées")
|
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:
|
with machine:
|
||||||
machine.delete()
|
machine.delete()
|
||||||
adherent['chbre']=u'EXT'
|
adherent['chbre']=u'EXT'
|
||||||
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
# On supprime le compte crans (on essaye)
|
# 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
|
# 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:
|
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
||||||
adherent['droits']=[unicode(d) for d in droits]
|
adherent['droits']=[unicode(d) for d in droits]
|
||||||
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
if adherent["uid"] and adherent["uid"][0] == self.conn.current_login:
|
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:
|
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:
|
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
||||||
adherent["etudes"]=[unicode(etablissement), unicode(annee), unicode(section)]
|
adherent["etudes"]=[unicode(etablissement), unicode(annee), unicode(section)]
|
||||||
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
raise Continue(cont(adherent=adherent))
|
raise Continue(cont(adherent=adherent))
|
||||||
|
|
|
@ -157,6 +157,7 @@ class Dialog(lc.Dialog):
|
||||||
try:
|
try:
|
||||||
with self.conn.search(dn=obj.dn, scope=0, mode='rw')[0] as obj:
|
with self.conn.search(dn=obj.dn, scope=0, mode='rw')[0] as obj:
|
||||||
obj['blacklist'].append(bl)
|
obj['blacklist'].append(bl)
|
||||||
|
obj.validate_changes()
|
||||||
obj.history_gen()
|
obj.history_gen()
|
||||||
obj.save()
|
obj.save()
|
||||||
# On s'en va en mettant à jour dans la continuation la valeur de obj
|
# On s'en va en mettant à jour dans la continuation la valeur de obj
|
||||||
|
@ -212,6 +213,7 @@ class Dialog(lc.Dialog):
|
||||||
try:
|
try:
|
||||||
with self.conn.search(dn=obj.dn, scope=0, mode='rw')[0] as obj:
|
with self.conn.search(dn=obj.dn, scope=0, mode='rw')[0] as obj:
|
||||||
obj['blacklist'][int(tag)]=bl
|
obj['blacklist'][int(tag)]=bl
|
||||||
|
obj.validate_changes()
|
||||||
obj.history_gen()
|
obj.history_gen()
|
||||||
obj.save()
|
obj.save()
|
||||||
# On s'en va en mettant à jour dans la continuation la valeur de obj
|
# On s'en va en mettant à jour dans la continuation la valeur de obj
|
||||||
|
|
|
@ -78,6 +78,7 @@ les valeurs valident sont :
|
||||||
certificat.tlsa(values['certificatUsage'], values['matchingType'])
|
certificat.tlsa(values['certificatUsage'], values['matchingType'])
|
||||||
certificat['portTCPin'] = [unicode(s, 'utf-8') for s in values['portTCPin'].split(separateur) if s]
|
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['portUDPin'] = [unicode(s, 'utf-8') for s in values['portUDPin'].split(separateur) if s]
|
||||||
|
certificat.validate_changes()
|
||||||
certificat.history_gen()
|
certificat.history_gen()
|
||||||
certificat.save()
|
certificat.save()
|
||||||
raise Continue(cont(certificat=certificat))
|
raise Continue(cont(certificat=certificat))
|
||||||
|
@ -118,6 +119,7 @@ les valeurs valident sont :
|
||||||
if certificat:
|
if certificat:
|
||||||
with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat:
|
with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat:
|
||||||
certificat['certificat'] = unicode(pem.strip(), 'utf-8')
|
certificat['certificat'] = unicode(pem.strip(), 'utf-8')
|
||||||
|
certificat.validate_changes()
|
||||||
certificat.history_gen()
|
certificat.history_gen()
|
||||||
certificat.save()
|
certificat.save()
|
||||||
else:
|
else:
|
||||||
|
@ -182,6 +184,7 @@ les valeurs valident sont :
|
||||||
raise ValueError("Il y a déjà une clef privée, merci d'annuler")
|
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:
|
with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat:
|
||||||
certificat.private(pem, encrypted=True)
|
certificat.private(pem, encrypted=True)
|
||||||
|
certificat.validate_changes()
|
||||||
certificat.history_gen()
|
certificat.history_gen()
|
||||||
certificat.save()
|
certificat.save()
|
||||||
self.dialog.msgbox("Clef privée bien ajouté", timeout=self.timeout, title="Ajout d'une clef privée")
|
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)
|
csr = crypto.dump_certificate_request(crypto.FILETYPE_PEM, req)
|
||||||
with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat:
|
with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat:
|
||||||
certificat['csr']=unicode(csr)
|
certificat['csr']=unicode(csr)
|
||||||
|
certificat.validate_changes()
|
||||||
certificat.history_gen()
|
certificat.history_gen()
|
||||||
certificat.save()
|
certificat.save()
|
||||||
self.handle_dialog(cont, box, csr)
|
self.handle_dialog(cont, box, csr)
|
||||||
|
@ -328,6 +332,7 @@ les valeurs valident sont :
|
||||||
if certificat:
|
if certificat:
|
||||||
with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat:
|
with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat:
|
||||||
certificat['csr'] = unicode(pem.strip(), 'utf-8')
|
certificat['csr'] = unicode(pem.strip(), 'utf-8')
|
||||||
|
certificat.validate_changes()
|
||||||
certificat.history_gen()
|
certificat.history_gen()
|
||||||
certificat.save()
|
certificat.save()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -129,6 +129,7 @@ class Dialog(CPS.Dialog):
|
||||||
obj[a.ldap_name]=values[a.ldap_name]
|
obj[a.ldap_name]=values[a.ldap_name]
|
||||||
elif not obj[a.ldap_name] and missing.get(a, missing['default']) != 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[a.ldap_name]=values[a.ldap_name]
|
||||||
|
obj.validate_changes()
|
||||||
obj.history_gen()
|
obj.history_gen()
|
||||||
obj.save()
|
obj.save()
|
||||||
# On s'en va en mettant à jour dans la continuation la valeur de obj
|
# 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):
|
def todo(obj, values, cont):
|
||||||
with self.conn.search(dn=obj.dn, scope=0, mode='rw')[0] as obj:
|
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[attr] = [unicode(value, 'utf-8') for value in values]
|
||||||
|
obj.validate_changes()
|
||||||
obj.history_gen()
|
obj.history_gen()
|
||||||
obj.save()
|
obj.save()
|
||||||
raise Continue(cont(**{update_obj:obj}))
|
raise Continue(cont(**{update_obj:obj}))
|
||||||
|
|
|
@ -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 ?"):
|
if not self.confirm_item(item=proprio, title="Création du compte crans pour l'adhérent ?"):
|
||||||
raise Continue(cont)
|
raise Continue(cont)
|
||||||
else:
|
else:
|
||||||
|
proprio.validate_changes()
|
||||||
proprio.history_gen()
|
proprio.history_gen()
|
||||||
proprio.save()
|
proprio.save()
|
||||||
self.dialog.msgbox(
|
self.dialog.msgbox(
|
||||||
|
@ -156,6 +157,7 @@ class Dialog(machine.Dialog, blacklist.Dialog):
|
||||||
else:
|
else:
|
||||||
with self.conn.search(dn=proprio.dn, scope=0, mode='rw')[0] as proprio:
|
with self.conn.search(dn=proprio.dn, scope=0, mode='rw')[0] as proprio:
|
||||||
proprio['userPassword']=unicode(lc_utils.hash_password(password))
|
proprio['userPassword']=unicode(lc_utils.hash_password(password))
|
||||||
|
proprio.validate_changes()
|
||||||
proprio.history_gen()
|
proprio.history_gen()
|
||||||
proprio.save()
|
proprio.save()
|
||||||
self.dialog.msgbox(
|
self.dialog.msgbox(
|
||||||
|
@ -191,6 +193,7 @@ class Dialog(machine.Dialog, blacklist.Dialog):
|
||||||
raise ValueError("Il faut entrer une adresse mail")
|
raise ValueError("Il faut entrer une adresse mail")
|
||||||
with self.conn.search(dn=proprio.dn, scope=0, mode='rw')[0] as proprio:
|
with self.conn.search(dn=proprio.dn, scope=0, mode='rw')[0] as proprio:
|
||||||
proprio.delete_compte(unicode(mail, 'utf-8'))
|
proprio.delete_compte(unicode(mail, 'utf-8'))
|
||||||
|
proprio.validate_changes()
|
||||||
proprio.history_gen()
|
proprio.history_gen()
|
||||||
proprio.save()
|
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]))
|
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
|
proprio["shadowExpire"]=0
|
||||||
else:
|
else:
|
||||||
proprio["shadowExpire"]=[]
|
proprio["shadowExpire"]=[]
|
||||||
|
proprio.validate_changes()
|
||||||
proprio.history_gen()
|
proprio.history_gen()
|
||||||
proprio.save()
|
proprio.save()
|
||||||
raise Continue(cont(proprio=proprio))
|
raise Continue(cont(proprio=proprio))
|
||||||
|
@ -256,6 +260,7 @@ class Dialog(machine.Dialog, blacklist.Dialog):
|
||||||
if shell and shell != output:
|
if shell and shell != output:
|
||||||
with self.conn.search(dn=proprio.dn, scope=0, mode='rw')[0] as proprio:
|
with self.conn.search(dn=proprio.dn, scope=0, mode='rw')[0] as proprio:
|
||||||
proprio['loginShell']=unicode(loginShell)
|
proprio['loginShell']=unicode(loginShell)
|
||||||
|
proprio.validate_changes()
|
||||||
proprio.history_gen()
|
proprio.history_gen()
|
||||||
proprio.save()
|
proprio.save()
|
||||||
self.dialog.msgbox("Shell modifié avec succès.\nLa modification peut prendre une quainzaine de minute avant d'être effective.",
|
self.dialog.msgbox("Shell modifié avec succès.\nLa modification peut prendre une quainzaine de minute avant d'être effective.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue