From 1c7207577b21f9268c4ab1c17843f08890c65ea2 Mon Sep 17 00:00:00 2001 From: glondu Date: Thu, 23 Mar 2006 16:09:46 +0100 Subject: [PATCH] Plus d'invits. darcs-hash:20060323150946-68412-e53639e21442ce0cd6006e8eff8cb521344eb9a8.gz --- gestion/config.py | 2 +- gestion/destroy-invite-ens.py | 13 ------------- gestion/gen_confs/firewall.py | 7 +++---- gestion/gen_confs/wifi_ng.py | 5 ++--- gestion/ldap_crans.py | 22 +++------------------- surveillance/deconnexion.py | 2 +- wifiweb/bornes.py | 2 +- 7 files changed, 11 insertions(+), 42 deletions(-) delete mode 100755 gestion/destroy-invite-ens.py diff --git a/gestion/config.py b/gestion/config.py index c7a99c75..720e316c 100644 --- a/gestion/config.py +++ b/gestion/config.py @@ -304,7 +304,7 @@ Message cr # à cause de leur firewall et de leur patte wifi. NETs = { 'wifi' : [ '138.231.149.0/24', '138.231.150.0/24' ], 'wifi-ens' : [ '138.231.151.0/25' ], - 'wifi-invite' : [ '138.231.151.128/25'], + 'wifi-invite' : [ '138.231.151.128/25'], # inutilisé 'b' : [ '138.231.137.0/24' ], 'm' : [ '138.231.138.0/24' ], 'c' : [ '138.231.139.0/24' ], diff --git a/gestion/destroy-invite-ens.py b/gestion/destroy-invite-ens.py deleted file mode 100755 index 66a9fd87..00000000 --- a/gestion/destroy-invite-ens.py +++ /dev/null @@ -1,13 +0,0 @@ -#! /usr/bin/env python -# -*- coding: iso-8859-15 -*- - -import sys -sys.path.append('/usr/scripts/gestion') - -from ldap_crans import Invite, crans_ldap - -machines = crans_ldap().search('host=invite-ens-*.wifi.crans.org','w')['machine'] - -for m in machines : - if m.proprietaire().__class__ == Invite : - m.delete('Machine invitée de l\'ens - détruite par cron') diff --git a/gestion/gen_confs/firewall.py b/gestion/gen_confs/firewall.py index f29fbfa6..fcb6b1fa 100755 --- a/gestion/gen_confs/firewall.py +++ b/gestion/gen_confs/firewall.py @@ -28,7 +28,7 @@ sys.path.append('/usr/scripts/gestion') import syslog import pwd from lock import * -from ldap_crans import crans_ldap, ann_scol, crans, Invite, hostname +from ldap_crans import crans_ldap, ann_scol, crans, hostname from ldap_crans import Machine, MachineWifi from affich_tools import * from commands import getstatusoutput @@ -287,10 +287,9 @@ class firewall_crans : # Mise à jour de la machine if AddrInNet(ip,self.zone_serveur) : serveur_maj = True - # Il faut avoir payé ou être une machine du crans ou un invite + # Il faut avoir payé ou être une machine du crans if db.search('paiement=ok&ip=%s'% ip)['machine'] or \ - machine[0].proprietaire().__class__ == crans or \ - machine[0].proprietaire().__class__ == Invite : + machine[0].proprietaire().__class__ == crans: mac_ip_maj[ip] = machine[0] else : mac_ip_maj[ip] = None diff --git a/gestion/gen_confs/wifi_ng.py b/gestion/gen_confs/wifi_ng.py index 8216f012..ce72ead1 100755 --- a/gestion/gen_confs/wifi_ng.py +++ b/gestion/gen_confs/wifi_ng.py @@ -6,7 +6,7 @@ from gen_confs import gen_config, ERREUR, OK, anim import sys, os, shutil sys.path.append('/usr/scripts/gestion') -from ldap_crans import crans_ldap, Invite, BorneWifi +from ldap_crans import crans_ldap, BorneWifi class conf_wifi_ng(gen_config) : """ Génération de la configuration de isakmpd dans ISAKMPD_CONF @@ -46,8 +46,7 @@ class conf_wifi_ng(gen_config) : def _gen(self): self.anim=anim('\r\tRecherche base LDAP') - clients = self.db.search('host=*.wifi.crans.org&paiement=ok')['machineWifi'] + \ - Invite().machines() + clients = self.db.search('host=*.wifi.crans.org&paiement=ok')['machineWifi'] bornes = self.db.search('host=*.wifi.crans.org&canal=*')['borneWifi'] print OK diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index 19d904bf..ab061ef0 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -804,8 +804,6 @@ class crans_ldap: if graphic: cprint('Lecture base LDAP', 'gras') # Machines de l'assoce self.__machines = crans(self.conn).machines() - # Machines des invités - self.__machines += Invite(self.conn).machines() # Machines des adhérents et clubs de l'année en cours base = self.search('paiement=ok') base = base['adherent'] + base['club'] @@ -2198,7 +2196,7 @@ class Machine(base_classes_crans): # Propriéraire inconnu mais ce n'est pas grave self.__proprietaire = None - elif t in [ adherent, club, crans, Invite ] and typ in [ 'fixe' , 'wifi' , 'borne' ]: + elif t in [ adherent, club, crans ] and typ in [ 'fixe' , 'wifi' , 'borne' ]: # Machine vide self.__proprietaire = parent_or_tuple self.dn = parent_or_tuple.dn @@ -2407,9 +2405,7 @@ class Machine(base_classes_crans): # Dans quel réseau la machine doit-elle être placée ? if self.__typ == 'wifi': - if self.proprietaire().__class__ == Invite: - net = config.NETs['wifi-invite'] - elif self.proprietaire().etudes(0) == "ENS" and self.proprietaire().etudes(1) == "Pers": + if self.proprietaire().etudes(0) == "ENS" and self.proprietaire().etudes(1) == "Pers": # Personnel ENS net = config.NETs['wifi-ens'] else: @@ -2516,7 +2512,7 @@ class Machine(base_classes_crans): def proprietaire(self): """ - retroune le propriétaire de la machine (classe adherent, club ou crans ou Invite) + retroune le propriétaire de la machine (classe adherent, club ou crans) """ if not self.__proprietaire: res = self.conn.search_s(','.join(self.dn.split(',')[1:]), 0) @@ -2524,8 +2520,6 @@ class Machine(base_classes_crans): self.__proprietaire = adherent(res[0], self._modifiable, self.conn) elif 'club' in res[0][1]['objectClass']: self.__proprietaire = club(res[0], self._modifiable, self.conn) - elif 'invite' in res[0][0]: - self.__proprietaire = Invite(self.conn) else: self.__proprietaire = crans(self.conn) @@ -2923,16 +2917,6 @@ class crans(_FakeProprio): def chbre(self): return u"CRA" -class Invite(_FakeProprio): - """ Propriétaire des machines invitées """ - def __init__(self, conn=None): - _FakeProprio.__init__(self, conn) - self.dn = "ou=invites," + self.base_dn - def Nom(self): - return u"Invité" - def chbre(self): - return u"N/A" - if __name__ == '__main__': import sys diff --git a/surveillance/deconnexion.py b/surveillance/deconnexion.py index 8d139fa2..6415d3da 100755 --- a/surveillance/deconnexion.py +++ b/surveillance/deconnexion.py @@ -22,7 +22,7 @@ from pyPgSQL import PgSQL sys.path.append('/usr/scripts/gestion') from config import upload, virus, p2p, NETs import smtplib -from ldap_crans import crans_ldap, crans, invite, base_classes_crans +from ldap_crans import crans_ldap, crans, base_classes_crans from ldap_crans import MachineWifi from time import * import locale diff --git a/wifiweb/bornes.py b/wifiweb/bornes.py index 667d36c2..a5d8d544 100755 --- a/wifiweb/bornes.py +++ b/wifiweb/bornes.py @@ -7,7 +7,7 @@ from session import session from utilisateurs import users sys.path.append('/usr/scripts/gestion') -from ldap_crans import crans_ldap, invite +from ldap_crans import crans_ldap db = crans_ldap() ######################################################