From c0223fc29ed841bba7fbe24667958bb3edc931e2 Mon Sep 17 00:00:00 2001 From: bos Date: Wed, 30 May 2007 22:02:03 +0200 Subject: [PATCH] Impression pour les clubs darcs-hash:20070530200203-c992d-a350d0f59467491516306c8d1947201b2db51130.gz --- intranet/Root.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/intranet/Root.py b/intranet/Root.py index 189f6399..6d2c0cba 100755 --- a/intranet/Root.py +++ b/intranet/Root.py @@ -106,6 +106,7 @@ def login(from_page = '', login = None, password = '', error_msg=''): 'values':{'login':login, 'password':password, 'from_page':from_page, 'message':error_msg}, 'standalone':True } + # # methode qui verifie le login # @@ -115,11 +116,24 @@ def verifLogin(login = '', password = ''): if login != '' and password != '': cherrypy.session['LDAP'] = CransLdap() LDAP = cherrypy.session['LDAP'] + login_club = None + if len(login.split('@')) > 1: + login_club = login.split('@')[1] + login = login.split('@')[0] adh = LDAP.search('uid=' + login)['adherent'][0] if adh.checkPassword(password): - cherrypy.session['uid'] = login + if login_club != None: + club = LDAP.search('uid=%s'%login_club)['club'][0] + if adh.id() not in club._data['responsable']: + raise Exception, "Pas respo club" + cherrypy.session['uid'] = login_club + cherrypy.session['droits'] = [] + cherrypy.session['estClub'] = True + else: + cherrypy.session['uid'] = login + cherrypy.session['droits'] = adh.droits() + cherrypy.session['estClub'] = False cherrypy.session['session_key'] = True - cherrypy.session['droits'] = adh.droits() cherrypy.log("User logged in : %s" % cherrypy.session['uid'], "LOGIN") return else: @@ -132,10 +146,6 @@ def verifLogin(login = '', password = ''): message = u"L'authentification a echoué." return message - - - - # on indique tout ca a cherrypy settings={'/': { 'sessionAuthenticateFilter.checkLoginAndPassword': verifLogin,