[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:
Antoine Durand-Gasselin 2009-03-23 11:18:13 +01:00
parent 0315f86997
commit 814c8bce1a
7 changed files with 129 additions and 117 deletions

View file

@ -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 #
# ######################################################## #