correction du bug de login (j'espre)
darcs-hash:20061117140933-f46e9-af7e3b0bf4126861a3e9f9c1eb09227c3c6535c7.gz
This commit is contained in:
parent
b488b68dcf
commit
4f3b212b2d
6 changed files with 80 additions and 86 deletions
|
@ -1,29 +1,34 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
# ##################################################################################################### #
|
||||
# Machines
|
||||
# ##################################################################################################### #
|
||||
# Description:
|
||||
# Affiche la liste des machies, les infons sur une machine et permet des modifications
|
||||
# Informations:
|
||||
#
|
||||
# Pages:
|
||||
# index:liste des machines + le reste (AJAX)
|
||||
#
|
||||
# ##################################################################################################### #
|
||||
import cherrypy, sys, os, datetime
|
||||
from time import strftime, localtime, time
|
||||
# libraries crans
|
||||
sys.path.append('/usr/scripts/gestion/')
|
||||
from config_mail import MailConfig
|
||||
|
||||
if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
|
||||
from ldap_crans_test import *
|
||||
# print("monCompte : unsing test ldap : env=" + cherrypy.config.configMap["global"]["server.environment"])
|
||||
# print("mesmachines : unsing test ldap : env=" + cherrypy.config.configMap["global"]["server.environment"])
|
||||
else:
|
||||
from ldap_crans import *
|
||||
# print("monCompte : unsing prod ldap : env=" + cherrypy.config.configMap["global"]["server.environment"])
|
||||
# print("mesmachines : unsing prod ldap : env=" + cherrypy.config.configMap["global"]["server.environment"])
|
||||
|
||||
|
||||
|
||||
class root:
|
||||
__ldap = None
|
||||
|
||||
def __init__(self):
|
||||
self.__ldap = cherrypy.config.configMap["global"]["crans_ldap"]
|
||||
|
||||
|
||||
def AJAXListeMachines(self):
|
||||
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||
machines = []
|
||||
for une_machine in adh.machines():
|
||||
machineInfos = {}
|
||||
|
@ -46,11 +51,11 @@ class root:
|
|||
|
||||
def AJAXMachineInfo(self, mid):
|
||||
try:
|
||||
machine = self.__ldap.search('mid=' + mid)['machine'][0]
|
||||
machine = cherrypy.session['LDAP'].search('mid=' + mid)['machine'][0]
|
||||
if machine.proprietaire().mail() != cherrypy.session['uid']:
|
||||
raise Exception
|
||||
# zamok -> pour tester l'affichage des ports, des alias
|
||||
#machine = self.__ldap.search('mid=896')['machine'][0]
|
||||
#machine = cherrypy.session['LDAP'].search('mid=896')['machine'][0]
|
||||
machineInfos = {}
|
||||
# nom, mac, mid, ip
|
||||
machineInfos['nom'] = machine.nom()
|
||||
|
@ -151,8 +156,8 @@ class root:
|
|||
##########################
|
||||
def AJAXChangerNom(self, mid, nouveauNom):
|
||||
try:
|
||||
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||
mach = self.__ldap.search('mid=' + mid, 'w')['machine'][0]
|
||||
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||
mach = cherrypy.session['LDAP'].search('mid=' + mid, 'w')['machine'][0]
|
||||
# tester si c'est bien la machine de l'adherent
|
||||
if mach.proprietaire().compte() != cherrypy.session['uid']:
|
||||
del adh, mach
|
||||
|
@ -172,8 +177,8 @@ class root:
|
|||
##########################
|
||||
def AJAXchangerMAC(self, mid, nouvelleMAC):
|
||||
try:
|
||||
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||
mach = self.__ldap.search('mid=' + mid, 'w')['machine'][0]
|
||||
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||
mach = cherrypy.session['LDAP'].search('mid=' + mid, 'w')['machine'][0]
|
||||
# tester si c'est bien la machine de l'adherent
|
||||
if mach.proprietaire().compte() != cherrypy.session['uid']:
|
||||
del adh, mach
|
||||
|
@ -194,8 +199,8 @@ class root:
|
|||
##########################
|
||||
def AJAXSupprimerMachine(self, mid):
|
||||
try:
|
||||
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||
mach = self.__ldap.search('mid=' + mid, 'w')['machine'][0]
|
||||
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||
mach = cherrypy.session['LDAP'].search('mid=' + mid, 'w')['machine'][0]
|
||||
# tester si c'est bien la machine de l'adherent
|
||||
if mach.proprietaire().compte() != cherrypy.session['uid']:
|
||||
del adh, mach
|
||||
|
@ -211,7 +216,7 @@ class root:
|
|||
# machine:creation
|
||||
##########################
|
||||
def AJAXCreerMachine(self, nomNouvelleMachine, MACNouvelleMachine, typeNouvelleMachine):
|
||||
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||
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.'}
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue