[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
|
@ -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':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue