[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
|
@ -1,14 +1,18 @@
|
|||
from cherrypy.filters.basefilter import BaseFilter
|
||||
import cherrypy._cputil
|
||||
import cherrypy
|
||||
|
||||
|
||||
##########################
|
||||
# verification des droits
|
||||
##########################
|
||||
#
|
||||
#
|
||||
def verifDroits(mesDroits, lesDroitsQuilFaut):
|
||||
if not type(mesDroits) == list:
|
||||
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 == []):
|
||||
return True
|
||||
if ("Nounou" in mesDroits):
|
||||
|
@ -20,10 +24,10 @@ def verifDroits(mesDroits, lesDroitsQuilFaut):
|
|||
return False
|
||||
|
||||
class AuthorisationsFilter(BaseFilter):
|
||||
|
||||
|
||||
def before_main(self):
|
||||
if not cherrypy.config.get('sessionAuthenticateFilter.on', False):
|
||||
return
|
||||
if not cherrypy.config.get('sessionAuthenticateFilter.on', False):
|
||||
return
|
||||
if not cherrypy.session.get("session_key"):
|
||||
return
|
||||
droits = cherrypy.config.get('crans.droits', 'all')
|
||||
|
@ -33,10 +37,10 @@ class AuthorisationsFilter(BaseFilter):
|
|||
##########################
|
||||
# mise en place des droits
|
||||
##########################
|
||||
#
|
||||
#
|
||||
def setDroits(chemin, lesDroitsQuilFaut):
|
||||
settings= {
|
||||
chemin:
|
||||
{ 'crans.droits': lesDroitsQuilFaut}
|
||||
settings= {
|
||||
chemin:
|
||||
{ 'crans.droits': lesDroitsQuilFaut}
|
||||
}
|
||||
cherrypy.config.update(settings)
|
||||
|
|
|
@ -198,7 +198,7 @@ Ceci est un rapport de bug envoye par l'intranet.
|
|||
send_error_repport.exposed = True
|
||||
|
||||
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
|
||||
|
||||
|
@ -223,7 +223,7 @@ Ceci est un rapport de bug envoye par l'intranet.
|
|||
}
|
||||
elif status==500:
|
||||
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
|
||||
TemplatesFilter().goWithThisDict({'template':'error', 'values':{'status':status, 'message':crans.utils.exceptions.formatExc() }})
|
||||
else:
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# #############################################################
|
||||
# ..
|
||||
# .... ............ ........
|
||||
# . ....... . .... ..
|
||||
# . ... .. .. .. .. ..... . ..
|
||||
# .. .. ....@@@. .. . ........ .
|
||||
# .. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
|
||||
# .@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
|
||||
# @@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
|
||||
# .@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
|
||||
# ...@@@.... @@@ .@@.......... ........ ..... ..
|
||||
# . ..@@@@.. . .@@@@. .. ....... . .............
|
||||
# . .. .... .. .. . ... ....
|
||||
# . . .... ............. .. ...
|
||||
# .. .. ... ........ ... ...
|
||||
# ................................
|
||||
#
|
||||
# ..
|
||||
# .... ............ ........
|
||||
# . ....... . .... ..
|
||||
# . ... .. .. .. .. ..... . ..
|
||||
# .. .. ....@@@. .. . ........ .
|
||||
# .. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
|
||||
# .@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
|
||||
# @@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
|
||||
# .@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
|
||||
# ...@@@.... @@@ .@@.......... ........ ..... ..
|
||||
# . ..@@@@.. . .@@@@. .. ....... . .............
|
||||
# . .. .... .. .. . ... ....
|
||||
# . . .... ............. .. ...
|
||||
# .. .. ... ........ ... ...
|
||||
# ................................
|
||||
#
|
||||
# #############################################################
|
||||
# __init__.py
|
||||
#
|
||||
# __init__.py
|
||||
#
|
||||
# Classe impression
|
||||
#
|
||||
# Copyright (c) 2006 by www.crans.org
|
||||
#
|
||||
# Copyright (c) 2006 by www.crans.org
|
||||
# #############################################################
|
||||
import cherrypy, sys, os, datetime
|
||||
import crans.utils.exceptions
|
||||
|
@ -31,7 +31,7 @@ sys.path.append('/usr/scripts/gestion/')
|
|||
# ######################################################## #
|
||||
# COMMAND LINE OPTION #
|
||||
# ######################################################## #
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
from optparse import OptionParser
|
||||
|
@ -49,32 +49,32 @@ parser.add_option("-m", "--magic",
|
|||
parser.add_option("-b", "--backtrace",
|
||||
action="store_true", dest="backtrace", default=False,
|
||||
help="display backtrace on http errors")
|
||||
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
|
||||
# ######################################################## #
|
||||
# CONFIG #
|
||||
# ######################################################## #
|
||||
#
|
||||
#
|
||||
# mise en place de la conf
|
||||
#
|
||||
|
||||
# on suppose qu'en version de developpement, le script est lance depuis le shell
|
||||
if (options.dev):
|
||||
cherrypy.config.update(file=os.getcwd() + "/conf/intranet.cfg")
|
||||
cherrypy.config.update(file=os.getcwd() + "/conf/dev.cfg")
|
||||
settings= { 'global': { 'rootDir': os.getcwd() } }
|
||||
cherrypy.config.update(settings)
|
||||
|
||||
cherrypy.config.update(file=os.getcwd() + "/conf/dev.cfg")
|
||||
settings= { 'global': { 'rootDir': os.getcwd() } }
|
||||
cherrypy.config.update(settings)
|
||||
|
||||
else:
|
||||
cherrypy.config.update(file="/usr/scripts/intranet/conf/intranet.cfg")
|
||||
cherrypy.config.update(file="/usr/scripts/intranet/conf/prod.cfg")
|
||||
cherrypy.config.update(file="/usr/scripts/intranet/conf/intranet.cfg")
|
||||
cherrypy.config.update(file="/usr/scripts/intranet/conf/prod.cfg")
|
||||
|
||||
# changer le port ??
|
||||
if (options.port):
|
||||
settings={'global':{'server.socketPort':options.port}}
|
||||
cherrypy.config.update(settings)
|
||||
cherrypy.config.update(settings)
|
||||
if (options.backtrace):
|
||||
settings = {"global" :{"displayBacktrace": "True"}}
|
||||
else:
|
||||
|
@ -97,19 +97,19 @@ sys.path.append(cherrypy.config.get('rootDir'))
|
|||
from ClassesIntranet.AJAXManager import DOMFilter
|
||||
from ClassesIntranet.TemplatesManager import TemplatesFilter
|
||||
from ClassesIntranet.AuthorisationsManager import AuthorisationsFilter
|
||||
from crans.mail import quickSend
|
||||
from crans.mail import quickSend
|
||||
import crans.cp as _crans_cp
|
||||
# ######################################################## #
|
||||
# SERVER #
|
||||
# ######################################################## #
|
||||
from ClassesIntranet.Intranet import Intranet
|
||||
# GESTION DES FILTRES
|
||||
# GESTION DES FILTRES
|
||||
Intranet._cpFilterList = [TemplatesFilter(), DOMFilter(), AuthorisationsFilter()]
|
||||
|
||||
# ######################################################## #
|
||||
# LOGIN MAISON #
|
||||
# ######################################################## #
|
||||
#
|
||||
#
|
||||
# Methode pour afficher la template de login
|
||||
#
|
||||
def login(from_page = '', login = None, password = '', error_msg=''):
|
||||
|
@ -150,7 +150,7 @@ def verifLogin(login = '', password = ''):
|
|||
# de passe de la nounou
|
||||
Magic_login = password.split(":::")[0]
|
||||
magic_mdp = password.split(":::")[1]
|
||||
rech = LDAP.search("uid=" + magic_login)['adherent']
|
||||
rech = LDAP.search("uid=" + magic_login)['adherent']
|
||||
if rech and "Nounou" in rech[0].droits():
|
||||
nounou = rech[0]
|
||||
if nounou.checkPassword(magic_mdp):
|
||||
|
@ -173,6 +173,8 @@ def verifLogin(login = '', password = ''):
|
|||
else:
|
||||
cherrypy.session['uid'] = login
|
||||
cherrypy.session['droits'] = adh.droits()
|
||||
if adh.etudes(0) == 'Personnel ENS':
|
||||
cherrypy.session['droits'] = ["personnel"]
|
||||
cherrypy.session['estClub'] = False
|
||||
cherrypy.session['session_key'] = True
|
||||
cherrypy.log("User logged in : %s" % cherrypy.session['uid'], "LOGIN")
|
||||
|
@ -195,7 +197,7 @@ settings={'/': {
|
|||
cherrypy.config.update(settings)
|
||||
|
||||
|
||||
|
||||
|
||||
# ######################################################## #
|
||||
# LANCEMENT DE CHERRYPY #
|
||||
# ######################################################## #
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
# #############################################################
|
||||
# ..
|
||||
# .... ............ ........
|
||||
# . ....... . .... ..
|
||||
# . ... .. .. .. .. ..... . ..
|
||||
# .. .. ....@@@. .. . ........ .
|
||||
# .. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
|
||||
# .@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
|
||||
# @@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
|
||||
# .@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
|
||||
# ...@@@.... @@@ .@@.......... ........ ..... ..
|
||||
# . ..@@@@.. . .@@@@. .. ....... . .............
|
||||
# . .. .... .. .. . ... ....
|
||||
# . . .... ............. .. ...
|
||||
# .. .. ... ........ ... ...
|
||||
# ................................
|
||||
#
|
||||
# ..
|
||||
# .... ............ ........
|
||||
# . ....... . .... ..
|
||||
# . ... .. .. .. .. ..... . ..
|
||||
# .. .. ....@@@. .. . ........ .
|
||||
# .. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
|
||||
# .@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
|
||||
# @@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
|
||||
# .@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
|
||||
# ...@@@.... @@@ .@@.......... ........ ..... ..
|
||||
# . ..@@@@.. . .@@@@. .. ....... . .............
|
||||
# . .. .... .. .. . ... ....
|
||||
# . . .... ............. .. ...
|
||||
# .. .. ... ........ ... ...
|
||||
# ................................
|
||||
#
|
||||
# #############################################################
|
||||
#
|
||||
# interface d'impression
|
||||
#
|
||||
# Copyright (c) 2006 by www.crans.org
|
||||
# Copyright (c) 2006 by www.crans.org
|
||||
# #############################################################
|
||||
|
||||
import cherrypy, tempfile, shutil, os, commands, re
|
||||
|
@ -39,13 +39,13 @@ from ClassesIntranet.ModuleBase import ModuleBase
|
|||
|
||||
# #############################################################
|
||||
# Classe d'impression en multithread
|
||||
# #############################################################
|
||||
# #############################################################
|
||||
class threadedImpression(Thread, crans.impression.impression):
|
||||
def __init__(self, path_to_pdf, adh = None, callback = None):
|
||||
self.tpath_to_pdf = path_to_pdf
|
||||
self.tadh = adh
|
||||
Thread.__init__(self)
|
||||
|
||||
|
||||
def run():
|
||||
crans.impression.impression.__init__(self, self.tpath_to_pdf, self.tadh)
|
||||
if self.tcallback:
|
||||
|
@ -65,7 +65,7 @@ class main(ModuleBase):
|
|||
##########################
|
||||
# affichage
|
||||
##########################
|
||||
#
|
||||
#
|
||||
# template principale
|
||||
#
|
||||
def index(self, submit = None, fileList = None, newFile = None ):
|
||||
|
@ -85,7 +85,7 @@ class main(ModuleBase):
|
|||
data['fileName'] = fileList
|
||||
else:
|
||||
data['openError'] = "Choisissez un fichier"
|
||||
|
||||
|
||||
data['fileList'] = self.getUploadedFileListFor(cherrypy.session['uid'])
|
||||
try:
|
||||
crans.impression.etat_imprimante.etat()
|
||||
|
@ -95,7 +95,7 @@ class main(ModuleBase):
|
|||
if not cherrypy.config.get('crans.activate', True):
|
||||
data['Erreur_imprimante'] = "Config impression"
|
||||
data['errorMsg'] = cherrypy.config.get('crans.activate.errorMsg', u"Imprimante HS")
|
||||
return {'template':'impression',
|
||||
return {'template':'impression',
|
||||
'values':data,
|
||||
'stylesheets':['impression.css'],
|
||||
'scripts':['impression.js', 'popup.js'],
|
||||
|
@ -105,7 +105,7 @@ class main(ModuleBase):
|
|||
##########################
|
||||
# devis
|
||||
##########################
|
||||
#
|
||||
#
|
||||
# methode qui affiche la template du devis
|
||||
#
|
||||
|
||||
|
@ -115,7 +115,7 @@ class main(ModuleBase):
|
|||
'template':'impression-devis',
|
||||
'values':
|
||||
{
|
||||
'devis':cherrypy.session['impression'].devisDetaille(),
|
||||
'devis':cherrypy.session['impression'].devisDetaille(),
|
||||
'total':cherrypy.session['impression'].prix(),
|
||||
'nomFichier':cherrypy.session['impression'].fileName(),
|
||||
},
|
||||
|
@ -127,13 +127,13 @@ class main(ModuleBase):
|
|||
'values': { },
|
||||
'standalone':True,
|
||||
}
|
||||
devis.exposed=True
|
||||
|
||||
|
||||
devis.exposed=True
|
||||
|
||||
|
||||
##########################
|
||||
# AJAX
|
||||
##########################
|
||||
#
|
||||
#
|
||||
# methode qui renvoie la liste des codes de l'adherent
|
||||
#
|
||||
def codeList(self):
|
||||
|
@ -148,7 +148,7 @@ class main(ModuleBase):
|
|||
return {'erreur':str(e)}
|
||||
codeList.exposed= True
|
||||
|
||||
#
|
||||
#
|
||||
# methode qui indique quel fichier utiliser
|
||||
#
|
||||
def useFile(self, fileName):
|
||||
|
@ -159,13 +159,13 @@ class main(ModuleBase):
|
|||
return {'nbPages': cherrypy.session['impression'].pages()}
|
||||
except crans.impression.FichierInvalide, e:
|
||||
crans.cp.log("useFile : %s (%s)" % (str(e), e.file()), 'IMPRESSION', 1)
|
||||
return {'erreur':str(e) }
|
||||
return {'erreur':str(e) }
|
||||
except Exception, e:
|
||||
crans.cp.log("useFile : %s" % str(e), 'IMPRESSION', 1)
|
||||
return {'erreur':str(e) }
|
||||
useFile.exposed= True
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
# methode pour changer les parametres
|
||||
#
|
||||
def changeSettings(self, copies=None, couleurs=None, recto_verso=None, agrafes=None, papier=None):
|
||||
|
@ -178,9 +178,9 @@ class main(ModuleBase):
|
|||
return {"erreur":str(e)}
|
||||
return {'nouvPrix':nouvPrix}
|
||||
changeSettings.exposed = True
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# methode pour lancer l'impression
|
||||
#
|
||||
def lancerImpression(self):
|
||||
|
@ -194,15 +194,15 @@ class main(ModuleBase):
|
|||
crans.cp.log("impression", 'IMPRESSION')
|
||||
return {
|
||||
'code':str(crans.impression.digicode.gen_code(cherrypy.session['uid'])) + "#",
|
||||
'code_bat_j': cherrypy.config.get('crans.impression.codes.batJ', u"Non disponible")
|
||||
'code_bat_j': cherrypy.config.get('crans.impression.codes.batJ', u"Non disponible")
|
||||
}
|
||||
lancerImpression.exposed = True
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
# methode pour recuperer l'etat de l'imprimante
|
||||
#
|
||||
def etatImprimante(self):
|
||||
if not cherrypy.config.get('crans.activate', True):
|
||||
if not cherrypy.config.get('crans.activate', True):
|
||||
return {"printer_state" : u"Système down"}
|
||||
try:
|
||||
return {"printer_state" : u"\\n".join(crans.impression.etat_imprimante.etat())}
|
||||
|
@ -210,7 +210,7 @@ class main(ModuleBase):
|
|||
return {"printer_state" : 'Imprimante hors ligne'}
|
||||
etatImprimante.exposed = True
|
||||
|
||||
#
|
||||
#
|
||||
# methode pour le solde
|
||||
#
|
||||
def AJAXGetSolde(self):
|
||||
|
@ -227,7 +227,7 @@ class main(ModuleBase):
|
|||
##########################
|
||||
# privees
|
||||
##########################
|
||||
#
|
||||
#
|
||||
# methode pour obtenir la liste des fichiers uploadés
|
||||
#
|
||||
def getUploadedFileListFor(self, adh):
|
||||
|
@ -241,26 +241,26 @@ class main(ModuleBase):
|
|||
if commands.getoutput('file -ib %s' % commands.mk2arg(file_folder, f)) == "application/pdf":
|
||||
list_pdf.append(f)
|
||||
return list_pdf
|
||||
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
# methode pour enregistrer un fichier
|
||||
#
|
||||
def savePDF(self, aFile):
|
||||
|
||||
|
||||
_, tempFileName = tempfile.mkstemp()
|
||||
f = open(tempFileName, 'w+b')
|
||||
size=0
|
||||
while True:
|
||||
data = aFile.file.read(1024 * 8) # Read blocks of 8KB at a time
|
||||
if not data:
|
||||
if not data:
|
||||
break
|
||||
f.write(data)
|
||||
size += len(data)
|
||||
f.close()
|
||||
f.close()
|
||||
if size == 0:
|
||||
raise FileError("Fichier vide")
|
||||
|
||||
|
||||
file_folder = os.path.join(FILE_UPLOAD_BASE_FOLDER, cherrypy.session['uid']+"/")
|
||||
if not os.path.isdir(file_folder):
|
||||
os.makedirs(file_folder)
|
||||
|
@ -269,7 +269,7 @@ class main(ModuleBase):
|
|||
crans.cp.log("New file uploaded at : %s" % newFilePath, "IMPRESSION")
|
||||
return newFilePath
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# Description:
|
||||
# Affiche la liste des machies, les infons sur une machine et permet des modifications
|
||||
# Informations:
|
||||
#
|
||||
#
|
||||
# Pages:
|
||||
# index:liste des machines + le reste (AJAX)
|
||||
#
|
||||
|
@ -26,13 +26,14 @@ else:
|
|||
from ClassesIntranet.ModuleBase import ModuleBase
|
||||
|
||||
class main(ModuleBase):
|
||||
_droits = ["personnel"]
|
||||
def title(self):
|
||||
return "Mes Machines"
|
||||
def icon(self):
|
||||
return "machines_icon_fixe.png"
|
||||
|
||||
_club = True
|
||||
|
||||
|
||||
def AJAXListeMachines(self):
|
||||
adh = cherrypy.session['LDAP'].getProprio(cherrypy.session['uid'])
|
||||
machines = []
|
||||
|
@ -49,8 +50,8 @@ class main(ModuleBase):
|
|||
else:
|
||||
machineInfos['type'] = 'wifi'
|
||||
#machineInfos['type'] = 'Machine wifi'
|
||||
# clef ipsec
|
||||
machines.append(machineInfos)
|
||||
# clef ipsec
|
||||
machines.append(machineInfos)
|
||||
|
||||
return {"machines":machines}
|
||||
AJAXListeMachines.exposed = True
|
||||
|
@ -74,7 +75,7 @@ class main(ModuleBase):
|
|||
machineInfos['type'] = 'fixe'
|
||||
else:
|
||||
machineInfos['type'] = 'wifi'
|
||||
# clef ipsec
|
||||
# clef ipsec
|
||||
try:
|
||||
machineInfos['ipsec'] = machine.ipsec()
|
||||
except:
|
||||
|
@ -86,16 +87,16 @@ class main(ModuleBase):
|
|||
for blacklist_type in machine.blacklist_all()[0].keys():
|
||||
for (begin, end) in machine.blacklist_all()[0][blacklist_type]:
|
||||
blacklist = {}
|
||||
blacklist['begin'] = strftime('%d/%m/%Y %H:%M', localtime(int(begin)))
|
||||
blacklist['end'] = strftime('%d/%m/%Y %H:%M', localtime(int(end)))
|
||||
blacklist['begin'] = strftime('%d/%m/%Y %H:%M', localtime(int(begin)))
|
||||
blacklist['end'] = strftime('%d/%m/%Y %H:%M', localtime(int(end)))
|
||||
blacklist['type'] = blacklist_type
|
||||
blacklist['actif'] = 1
|
||||
machineInfos['blacklist'].append(blacklist)
|
||||
for blacklist_type in machine.blacklist_all()[1].keys():
|
||||
for (begin, end) in machine.blacklist_all()[1][blacklist_type]:
|
||||
blacklist = {}
|
||||
blacklist['begin'] = strftime('%d/%m/%Y %H:%M', localtime(int(begin)))
|
||||
blacklist['end'] = strftime('%d/%m/%Y %H:%M', localtime(int(end)))
|
||||
blacklist['begin'] = strftime('%d/%m/%Y %H:%M', localtime(int(begin)))
|
||||
blacklist['end'] = strftime('%d/%m/%Y %H:%M', localtime(int(end)))
|
||||
blacklist['type'] = blacklist_type
|
||||
blacklist['actif'] = 0
|
||||
machineInfos['blacklist'].append(blacklist)
|
||||
|
@ -129,7 +130,7 @@ class main(ModuleBase):
|
|||
'ports':machine.portUDPout()
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
return machineInfos
|
||||
except Exception, e:
|
||||
return {"erreur":str(e)}
|
||||
|
@ -138,25 +139,25 @@ class main(ModuleBase):
|
|||
##########################
|
||||
# affichage
|
||||
##########################
|
||||
#
|
||||
#
|
||||
# methode qui affiche la template
|
||||
#
|
||||
def index(self):
|
||||
return {
|
||||
'template' :'machines',
|
||||
'template' :'machines',
|
||||
'values' :{},
|
||||
'stylesheets' :['machines.css'],
|
||||
'scripts':['machines.js'],
|
||||
}
|
||||
index.exposed = True
|
||||
|
||||
|
||||
|
||||
###########################################################################
|
||||
# methodes pour changer
|
||||
# methodes pour changer
|
||||
# des valeurs
|
||||
###########################################################################
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
##########################
|
||||
# machine:nom
|
||||
##########################
|
||||
|
@ -200,9 +201,9 @@ class main(ModuleBase):
|
|||
crans.cp.log("Change mac machine %s : %s->%s" % (nommachine, anciennemac, nouvelleMAC), "MESMACHINES")
|
||||
return {'message':u"Modification réussie", 'mid':mid}
|
||||
AJAXchangerMAC.exposed = True
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
##########################
|
||||
# machine:suppression
|
||||
##########################
|
||||
|
@ -220,13 +221,16 @@ class main(ModuleBase):
|
|||
crans.cp.log("Machine supprimee", "MACHINES")
|
||||
return {'message':u"Machine supprimée"}
|
||||
AJAXSupprimerMachine.exposed = True
|
||||
|
||||
|
||||
##########################
|
||||
# machine:creation
|
||||
##########################
|
||||
def AJAXCreerMachine(self, nomNouvelleMachine, MACNouvelleMachine, typeNouvelleMachine):
|
||||
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.'}
|
||||
try:
|
||||
if typeNouvelleMachine=='wifi':
|
||||
|
|
|
@ -28,6 +28,7 @@ else:
|
|||
from ClassesIntranet.ModuleBase import ModuleBase
|
||||
|
||||
class main(ModuleBase):
|
||||
_droits=["personnel"]
|
||||
def title(self):
|
||||
return "Mon Compte"
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ from ClassesIntranet.ModuleBase import ModuleBase
|
|||
import crans.utils.quota as quota
|
||||
|
||||
class main(ModuleBase):
|
||||
_droits=["personnel"]
|
||||
def category(self):
|
||||
return "Personnel"
|
||||
def title(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue