verification des droits avant envoi

This commit is contained in:
root 2012-06-02 18:33:32 +02:00
parent 15c0208e2f
commit 0f9236e341

View file

@ -2,8 +2,8 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
"""cranspasswords-server.py: Serveur pour cranspasswords""" """cranspasswords-server.py: Serveur pour cranspasswords"""
MYDIR = '/home/dstan/cranspasswords/' MYDIR = '/root/cranspasswords/'
STORE = MYDIR+'test/' STORE = MYDIR+'db/'
import glob import glob
import os import os
@ -43,7 +43,6 @@ KEYS = {
} }
RTC=[ RTC=[
"dandrimont",
"iffrig" "iffrig"
] ]
NOUNOUS=RTC+[ NOUNOUS=RTC+[
@ -69,7 +68,7 @@ ROLES = {
"ca": CA, "ca": CA,
"ca-w": CA, "ca-w": CA,
"nounous": NOUNOUS, "nounous": NOUNOUS,
"nounous-w": NOUNOUS #Or maybe RTC ? "nounous-w": RTC
} }
@ -121,7 +120,10 @@ def getfile(filename):
filepath = getpath(filename) filepath = getpath(filename)
try: try:
return json.loads(open(filepath).read()) obj = json.loads(open(filepath).read())
if not validate(obj['roles']):
return False
return obj
except IOError: except IOError:
return False return False