[intranet] donne les bons droits pour les personnels de l'ENS
Ignore-this: 49350a51cd5a38b1f430f10fad297fe0 darcs-hash:20090323101813-bd074-9d7c93b53555ab69a236545106c056b2e2f36008.gz
This commit is contained in:
parent
0315f86997
commit
814c8bce1a
7 changed files with 129 additions and 117 deletions
|
@ -9,6 +9,10 @@ import cherrypy
|
||||||
def verifDroits(mesDroits, lesDroitsQuilFaut):
|
def verifDroits(mesDroits, lesDroitsQuilFaut):
|
||||||
if not type(mesDroits) == list:
|
if not type(mesDroits) == list:
|
||||||
raise ValueError, "mesDroits doit etre une liste"
|
raise ValueError, "mesDroits doit etre une liste"
|
||||||
|
if "personnel" in mesDroits and not "personnel" in lesDroitsQuilFaut:
|
||||||
|
return False
|
||||||
|
elif "personnel" in lesDroitsQuilFaut:
|
||||||
|
return True
|
||||||
if (lesDroitsQuilFaut == "all") or (lesDroitsQuilFaut == []):
|
if (lesDroitsQuilFaut == "all") or (lesDroitsQuilFaut == []):
|
||||||
return True
|
return True
|
||||||
if ("Nounou" in mesDroits):
|
if ("Nounou" in mesDroits):
|
||||||
|
|
|
@ -198,7 +198,7 @@ Ceci est un rapport de bug envoye par l'intranet.
|
||||||
send_error_repport.exposed = True
|
send_error_repport.exposed = True
|
||||||
|
|
||||||
def testErreur(self):
|
def testErreur(self):
|
||||||
raise Exception, "Fausse alerte ! (test du systèmede gestion des erreurs)"
|
raise Exception, u"Fausse alerte ! (test du système de gestion des erreurs)"
|
||||||
|
|
||||||
testErreur.exposed = True
|
testErreur.exposed = True
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ Ceci est un rapport de bug envoye par l'intranet.
|
||||||
}
|
}
|
||||||
elif status==500:
|
elif status==500:
|
||||||
self.send_error_repport(status = status, message = message )
|
self.send_error_repport(status = status, message = message )
|
||||||
# les filtres ne sont pas appliques a la main...
|
# les filtres ne sont pas appliques à la main...
|
||||||
from TemplatesManager import TemplatesFilter
|
from TemplatesManager import TemplatesFilter
|
||||||
TemplatesFilter().goWithThisDict({'template':'error', 'values':{'status':status, 'message':crans.utils.exceptions.formatExc() }})
|
TemplatesFilter().goWithThisDict({'template':'error', 'values':{'status':status, 'message':crans.utils.exceptions.formatExc() }})
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -173,6 +173,8 @@ def verifLogin(login = '', password = ''):
|
||||||
else:
|
else:
|
||||||
cherrypy.session['uid'] = login
|
cherrypy.session['uid'] = login
|
||||||
cherrypy.session['droits'] = adh.droits()
|
cherrypy.session['droits'] = adh.droits()
|
||||||
|
if adh.etudes(0) == 'Personnel ENS':
|
||||||
|
cherrypy.session['droits'] = ["personnel"]
|
||||||
cherrypy.session['estClub'] = False
|
cherrypy.session['estClub'] = False
|
||||||
cherrypy.session['session_key'] = True
|
cherrypy.session['session_key'] = True
|
||||||
cherrypy.log("User logged in : %s" % cherrypy.session['uid'], "LOGIN")
|
cherrypy.log("User logged in : %s" % cherrypy.session['uid'], "LOGIN")
|
||||||
|
|
|
@ -26,6 +26,7 @@ else:
|
||||||
from ClassesIntranet.ModuleBase import ModuleBase
|
from ClassesIntranet.ModuleBase import ModuleBase
|
||||||
|
|
||||||
class main(ModuleBase):
|
class main(ModuleBase):
|
||||||
|
_droits = ["personnel"]
|
||||||
def title(self):
|
def title(self):
|
||||||
return "Mes Machines"
|
return "Mes Machines"
|
||||||
def icon(self):
|
def icon(self):
|
||||||
|
@ -226,7 +227,10 @@ class main(ModuleBase):
|
||||||
##########################
|
##########################
|
||||||
def AJAXCreerMachine(self, nomNouvelleMachine, MACNouvelleMachine, typeNouvelleMachine):
|
def AJAXCreerMachine(self, nomNouvelleMachine, MACNouvelleMachine, typeNouvelleMachine):
|
||||||
adh = cherrypy.session['LDAP'].getProprio(cherrypy.session['uid'])
|
adh = cherrypy.session['LDAP'].getProprio(cherrypy.session['uid'])
|
||||||
if typeNouvelleMachine=='fixe' and adh.droits() == [] and adh.machines_fixes() != []:
|
est_personnel = adh.etudes(0) == 'Personnel ENS'
|
||||||
|
if est_personnel and typeNouvelleMachine == 'wifi':
|
||||||
|
return {'error':'Vous n\'avez pas la possibilite d\'enregistrer de machine WiFi.'}
|
||||||
|
if typeNouvelleMachine=='fixe' and adh.droits() == [] and adh.machines_fixes() != [] and not est_personnel:
|
||||||
return {'error':'Vous avez deja une machine fixe. Vous ne pouvez ajouter que des machines WiFi.'}
|
return {'error':'Vous avez deja une machine fixe. Vous ne pouvez ajouter que des machines WiFi.'}
|
||||||
try:
|
try:
|
||||||
if typeNouvelleMachine=='wifi':
|
if typeNouvelleMachine=='wifi':
|
||||||
|
|
|
@ -28,6 +28,7 @@ else:
|
||||||
from ClassesIntranet.ModuleBase import ModuleBase
|
from ClassesIntranet.ModuleBase import ModuleBase
|
||||||
|
|
||||||
class main(ModuleBase):
|
class main(ModuleBase):
|
||||||
|
_droits=["personnel"]
|
||||||
def title(self):
|
def title(self):
|
||||||
return "Mon Compte"
|
return "Mon Compte"
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ from ClassesIntranet.ModuleBase import ModuleBase
|
||||||
import crans.utils.quota as quota
|
import crans.utils.quota as quota
|
||||||
|
|
||||||
class main(ModuleBase):
|
class main(ModuleBase):
|
||||||
|
_droits=["personnel"]
|
||||||
def category(self):
|
def category(self):
|
||||||
return "Personnel"
|
return "Personnel"
|
||||||
def title(self):
|
def title(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue