From 7bcf8a0a1bcbe1d5b9d841b09175433c222a99eb Mon Sep 17 00:00:00 2001 From: Daniel STAN <daniel.stan@crans.org> Date: Sat, 2 Jun 2012 13:49:26 +0200 Subject: [PATCH] =?UTF-8?q?Roles=20par=20d=C3=A9faut=20=3D=20ceux=20en=20?= =?UTF-8?q?=C3=A9criture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cranspasswords.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cranspasswords.py b/cranspasswords.py index 9354915..13ef781 100755 --- a/cranspasswords.py +++ b/cranspasswords.py @@ -259,14 +259,21 @@ def edit_file(fname): if not confirm("Créer fichier ?"): return texte = "" - value = {'roles':get_my_roles()} + roles = get_my_roles() + # Par défaut les roles d'un fichier sont ceux en écriture de son + # créateur + roles = [ r[:-2] for r in filter(lamba r: r.endswith('-w'),roles)] + if roles == []: + print "Vous ne possédez aucun rôle en écriture ! Abandon." + return + value = {'roles':roles} else: (sin,sout) = gpg('decrypt') sin.write(value['contents']) sin.close() texte = sout.read() ntexte = editor(texte) - if ntexte == None and not nfile and NROLES != None: + if ntexte == None and not nfile and NROLES == None: print "Pas de modifications effectuées" else: if put_password(fname,value['roles'],ntexte): -- GitLab