Utilisable par les clubs

darcs-hash:20070530223848-c992d-a122d072707c59d5fd491cb501f00b9d7dec8c91.gz
This commit is contained in:
bos 2007-05-31 00:38:48 +02:00
parent 68826f87db
commit 7580abe8c5

View file

@ -31,8 +31,10 @@ class main(ModuleBase):
def icon(self): def icon(self):
return "machines_icon_fixe.png" return "machines_icon_fixe.png"
_club = True
def AJAXListeMachines(self): def AJAXListeMachines(self):
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0] adh = cherrypy.session['LDAP'].getProprio(cherrypy.session['uid'])
machines = [] machines = []
for une_machine in adh.machines(): for une_machine in adh.machines():
machineInfos = {} machineInfos = {}
@ -160,7 +162,7 @@ class main(ModuleBase):
########################## ##########################
def AJAXChangerNom(self, mid, nouveauNom): def AJAXChangerNom(self, mid, nouveauNom):
try: try:
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0] adh = cherrypy.session['LDAP'].getProprio(cherrypy.session['uid'])
mach = cherrypy.session['LDAP'].search('mid=' + mid, 'w')['machine'][0] mach = cherrypy.session['LDAP'].search('mid=' + mid, 'w')['machine'][0]
# tester si c'est bien la machine de l'adherent # tester si c'est bien la machine de l'adherent
if mach.proprietaire().compte() != cherrypy.session['uid']: if mach.proprietaire().compte() != cherrypy.session['uid']:
@ -182,7 +184,7 @@ class main(ModuleBase):
########################## ##########################
def AJAXchangerMAC(self, mid, nouvelleMAC): def AJAXchangerMAC(self, mid, nouvelleMAC):
try: try:
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0] adh = cherrypy.session['LDAP'].getProprio(cherrypy.session['uid'])
mach = cherrypy.session['LDAP'].search('mid=' + mid, 'w')['machine'][0] mach = cherrypy.session['LDAP'].search('mid=' + mid, 'w')['machine'][0]
# tester si c'est bien la machine de l'adherent # tester si c'est bien la machine de l'adherent
if mach.proprietaire().compte() != cherrypy.session['uid']: if mach.proprietaire().compte() != cherrypy.session['uid']:
@ -206,7 +208,7 @@ class main(ModuleBase):
########################## ##########################
def AJAXSupprimerMachine(self, mid): def AJAXSupprimerMachine(self, mid):
try: try:
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0] adh = cherrypy.session['LDAP'].getProprio(cherrypy.session['uid'])
mach = cherrypy.session['LDAP'].search('mid=' + mid, 'w')['machine'][0] mach = cherrypy.session['LDAP'].search('mid=' + mid, 'w')['machine'][0]
# tester si c'est bien la machine de l'adherent # tester si c'est bien la machine de l'adherent
if mach.proprietaire().compte() != cherrypy.session['uid']: if mach.proprietaire().compte() != cherrypy.session['uid']:
@ -223,7 +225,7 @@ class main(ModuleBase):
# machine:creation # machine:creation
########################## ##########################
def AJAXCreerMachine(self, nomNouvelleMachine, MACNouvelleMachine, typeNouvelleMachine): def AJAXCreerMachine(self, nomNouvelleMachine, MACNouvelleMachine, typeNouvelleMachine):
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0] adh = cherrypy.session['LDAP'].getProprio(cherrypy.session['uid'])
if typeNouvelleMachine=='fixe' and adh.droits() == [] and adh.machines_fixes() != []: if typeNouvelleMachine=='fixe' and adh.droits() == [] and adh.machines_fixes() != []:
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: