From 0f9236e3418af82306d8b601e60f6d0e1fc5d846 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 2 Jun 2012 18:33:32 +0200 Subject: [PATCH] verification des droits avant envoi --- cranspasswords-server.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cranspasswords-server.py b/cranspasswords-server.py index 5695cd1..63c8b03 100755 --- a/cranspasswords-server.py +++ b/cranspasswords-server.py @@ -2,8 +2,8 @@ # -*- encoding: utf-8 -*- """cranspasswords-server.py: Serveur pour cranspasswords""" -MYDIR = '/home/dstan/cranspasswords/' -STORE = MYDIR+'test/' +MYDIR = '/root/cranspasswords/' +STORE = MYDIR+'db/' import glob import os @@ -43,7 +43,6 @@ KEYS = { } RTC=[ - "dandrimont", "iffrig" ] NOUNOUS=RTC+[ @@ -69,7 +68,7 @@ ROLES = { "ca": CA, "ca-w": CA, "nounous": NOUNOUS, - "nounous-w": NOUNOUS #Or maybe RTC ? + "nounous-w": RTC } @@ -121,7 +120,10 @@ def getfile(filename): filepath = getpath(filename) try: - return json.loads(open(filepath).read()) + obj = json.loads(open(filepath).read()) + if not validate(obj['roles']): + return False + return obj except IOError: return False