From a09ef77d22f72cec9a4cfb3275da7b2f5e0d2331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= Date: Thu, 16 Jul 2015 17:51:25 -0600 Subject: [PATCH] =?UTF-8?q?Droppe=20ce=20qui=20concerne=20la=20carte=20d'?= =?UTF-8?q?=C3=A9tudiant,=20et=20les=20blacklistes=20obsol=C3=A8tes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gestion/config/config.py | 50 +++++++++++++++++------------------ gestion/gen_confs/generate.py | 4 --- gestion/gest_crans.py | 42 +++++++---------------------- gestion/ldap_crans.py | 32 +++------------------- 4 files changed, 36 insertions(+), 92 deletions(-) diff --git a/gestion/config/config.py b/gestion/config/config.py index 47ef20ad..fd40a05b 100644 --- a/gestion/config/config.py +++ b/gestion/config/config.py @@ -35,14 +35,6 @@ else: debut_periode_transitoire = time.mktime(time.strptime("%s/08/16 00:00:00" % (ann_scol,), "%Y/%m/%d %H:%M:%S")) fin_periode_transitoire = time.mktime(time.strptime("%s/09/30 23:59:59" % (ann_scol,), "%Y/%m/%d %H:%M:%S")) -## Bloquage si carte d'étudiants manquante pour l'année en cours -# /!\ Par sécurité, ces valeurs sont considérées comme False si -# periode_transitoire est True -# Soft (au niveau du Squid) -bl_carte_et_actif = not (dat[1] in [9, 10] or dat[1] == 11 and dat[2] < 7) -# Hard (l'adhérent est considéré comme paiement pas ok) -bl_carte_et_definitif = not(dat[1] == 11 and dat[2] < 17) - #Sursis pour les inscription après le 1/11 pour fournir la carte étudiant sursis_carte=8*24*3600 @@ -415,29 +407,35 @@ file_pickle = { 4 : '/tmp/ipt_pickle', ################################################################################## #: Items de la blackliste -blacklist_items = { u'bloq': u'Blocage total de tous les services', - u'carte_etudiant': u'Carte etudiant manquante', - u'paiement': u'Paiement manquant cette année', - u'virus': u'Passage en VLAN isolement', - u'upload': u"Bridage du débit montant vers l'extérieur", - u'p2p': u"Blocage total de l'accès à l'extérieur", - u'autodisc_virus': u'Autodisconnect pour virus', - u'autodisc_upload': u'Autodisconnect pour upload', - u'autodisc_p2p': u'Autodisconnect pour P2P', - u'ipv6_ra': u'Isolement pour RA', - u'mail_invalide': u'Blocage pour mail invalide', - u'warez' : u"Présence de contenu violant de droit d'auteur sur zamok", - } +blacklist_items = { + u'bloq': u'Blocage total de tous les services', + u'paiement': u'Paiement manquant cette année', + u'virus': u'Passage en VLAN isolement', + u'upload': u"Bridage du débit montant vers l'extérieur", + u'autodisc_upload': u'Autodisconnect pour upload', + u'ipv6_ra': u'Isolement pour RA', + u'mail_invalide': u'Blocage pour mail invalide', + u'warez' : u"Présence de contenu violant de droit d'auteur sur zamok", +} #: Blacklistes entrainant une déconnexion complète -blacklist_sanctions = ['warez', 'p2p', 'autodisc_p2p','autodisc_virus','virus', 'bloq', +blacklist_sanctions = [ + 'warez', + 'virus', + 'bloq', 'paiement', ] -if bl_carte_et_definitif: - blacklist_sanctions.append('carte_etudiant') + #: Blacklistes redirigeant le port 80 en http vers le portail captif (avec des explications) -blacklist_sanctions_soft = ['autodisc_virus','ipv6_ra','mail_invalide','virus', - 'warez', 'p2p', 'autodisc_p2p', 'bloq','carte_etudiant','chambre_invalide'] +blacklist_sanctions_soft = [ + 'ipv6_ra', + 'mail_invalide', + 'virus', + 'warez', + 'bloq', + 'chambre_invalide', +] + #: Blacklistes entrainant un bridage de la connexion pour upload blacklist_bridage_upload = ['autodisc_upload', 'upload'] diff --git a/gestion/gen_confs/generate.py b/gestion/gen_confs/generate.py index a3390e20..46b2937d 100755 --- a/gestion/gen_confs/generate.py +++ b/gestion/gen_confs/generate.py @@ -45,17 +45,13 @@ class base_reconfigure: 'macip': [ _s + '-macip' for _s in __firewalled_servers ], # 'droits': [ 'rouge-droits', 'ragnarok-droits' ], 'blacklist': __blacklist_servers, - 'bl_carte_etudiant': __blacklist_servers, 'bl_chbre_invalide': __blacklist_servers, 'blacklist_mail_invalide': __blacklist_servers, 'blacklist_virus': __blacklist_servers, 'blacklist_warez': __blacklist_servers, 'blacklist_ipv6_ra': __blacklist_servers, 'blacklist_upload': __blacklist_servers, - 'blacklist_p2p': __blacklist_servers, - 'blacklist_autodisc_virus': __blacklist_servers, 'blacklist_autodisc_upload': __blacklist_servers, - 'blacklist_autodisc_p2p': __blacklist_servers, 'blacklist_bloq': __blacklist_servers, 'del_user': [ 'zbee-del_user', 'owl-del_user', 'zamok-del_user' ], 'port': ['%s-port' % _s for _s in __services.get('connection-main', [])], diff --git a/gestion/gest_crans.py b/gestion/gest_crans.py index 7e95560f..716c0c1a 100755 --- a/gestion/gest_crans.py +++ b/gestion/gest_crans.py @@ -1403,30 +1403,18 @@ def set_admin(proprio): Définition de l'état administratif : carte d'étudiant et paiement. """ # Le proprietaire a-t-il une section carte d'étudiant (pas les clubs) ? - has_card = proprio.idn != 'cid' + potential_ma = proprio.idn != 'cid' # Initialisation des différentes checkbox - carte = on_off(proprio.carteEtudiant()) - carte_ok = on_off('c' in proprio.controle()) - if has_card: charte_MA = on_off(proprio.charteMA()) + if potential_ma: + charte_MA = on_off(proprio.charteMA()) # Construction de la boîte de dialogue texte = [] checklist = [] - if has_card: - if carte_ok == 'off' or iscontroleur: - checklist.append(u'"1" "Carte d\'étudiant fournie" "%s"' % - (carte,)) - else: - texte.append(u'Carte vérifiée') - if iscontroleur: - if has_card: - checklist.append(u'"2" "Carte d\'étudiant vérifiée" "%s"' % carte_ok) - - # Carte et paiement de l'année précédente - if (isbureau or isadm) and has_card: - checklist.append(u'"3" "Charte des MA signee" "%s"' % charte_MA) + if (isbureau or isadm) and potential_ma: + checklist.append(u'"1" "Charte des MA signee" "%s"' % charte_MA) if not checklist: # Il n'y a rien de modifiable @@ -1434,7 +1422,6 @@ def set_admin(proprio): (proprio.Nom(), '\n'.join(texte))) return - # Il y a qqch de modifiable, on construit la checklist arg = u'--title "Etat administratif de %s" ' % proprio.Nom() arg += u'--separate-output ' @@ -1444,21 +1431,10 @@ def set_admin(proprio): annul, result = dialog(arg) if annul: return 1 - # Traitement - if has_card: + if potential_ma and (isadm or isbureau): if '1' in result: - proprio.carteEtudiant(True) - elif iscontroleur or carte_ok == 'off': - proprio.carteEtudiant(False) - if '2' in result: - proprio.controle('+c') - else: - proprio.controle('-c') - - if has_card: - if '3' in result: proprio.charteMA(True) - elif isadm or isbureau: + else: proprio.charteMA(False) def set_adhesion(proprio): @@ -2179,7 +2155,7 @@ def modif_adher(adher): arg += u'--menu "Que souhaitez vous modifier ?" 0 0 0 ' arg += u'"Connexion" "Mise à jour de l\'accès Internet (effectue la réadhésion si besoin)" ' arg += u'"Adhesion" "Pour toute réadhésion *sans* connexion." ' - arg += u'"Administratif" "Pour renseigner la fournitire de la charte des MA, de la carte d\'étudiant." ' + arg += u'"Administratif" "Pour renseigner la fournitire de la charte des MA." ' arg += u'"Etat-civil" "Nom, prénom" ' if adher.chbre() == 'EXT': arg += u'"Adresse" "Déménagement" ' @@ -2661,7 +2637,7 @@ def menu_principal(): arg += u'"" "---------------------------------------" "" ' arg += u'"aA" "Inscrire un nouvel adhérent" "" ' - arg += u'"mA" "Modifier l\'inscription d\'un adhérent" "Changer la chambre, la remarque, la section, la carte d\'étudiant ou précâbler." ' + arg += u'"mA" "Modifier l\'inscription d\'un adhérent" "Changer la chambre, la remarque, la section ou précâbler." ' arg += u'"aMA" "Ajouter une machine à un adhérent" "" ' arg += u'"dA" "Détruire un adhérent" "Suppression de l\'adhérent ainsi que de ses machines" ' arg += u'"" "---------------------------------------" "" ' diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index 35962406..afedc434 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -774,8 +774,6 @@ class CransLdap: el = "(|(paiement=%s)(finAdhesion>=%s))" % (config.ann_scol, generalizedTimeFormat(time.time())) # Doit-on bloquer en cas de manque de la carte d'etudiant ? # (si période transitoire on ne bloque dans aucun cas) - if config.bl_carte_et_definitif: - el = "(&(|(objectClass=club)(carteEtudiant=*))%s)" % (el,) elif champ[1:] == 'blacklist': el = '(blacklist=%s)' % expr else: @@ -1064,8 +1062,6 @@ class BaseClasseCrans(CransLdap): elif isinstance(self, Adherent) and (self.adhesion() > time.time() and self.connexion() > time.time()): # blacklistes virtuelle si on est un adhérent pour carte étudiant et chambre invalides - if not config.periode_transitoire and config.bl_carte_et_actif and not bool(self.carteEtudiant()) and not self.sursis_carte(): - actifs['carte_etudiant']=('-','-') if self.chbre() == '????': actifs['chambre_invalide']=('-','-') @@ -1260,7 +1256,7 @@ class BaseClasseCrans(CransLdap): valeur_finale) # Formate les entrées de l'historique de la forme champ+diff-diff - for champ in ['droits', 'controle', 'paiement', 'carteEtudiant', + for champ in ['droits', 'controle', 'paiement', 'mailAlias', 'hostAlias', 'exempt', 'nvram', 'portTCPin', 'portTCPout', 'portUDPin', 'portUDPout', 'homepageAlias', 'imprimeurClub', 'gpgFingerprint', @@ -1939,25 +1935,13 @@ class BaseProprietaire(BaseClasseCrans): self._set('uidNumber', [new]) return new - def sursis_carte(self): - if not config.bl_carte_et_actif: - return True - for h in self.historique()[::-1]: - x=re.match("(.*),.* : .*(paiement\+%s|inscription).*" % config.ann_scol,h) - if x != None: - return ((time.time()-time.mktime(time.strptime(x.group(1),'%d/%m/%Y %H:%M')))<=config.sursis_carte) - return False - def paiement_ok(self): if isinstance(self, Adherent): m_paiement = min(self.adhesion(), self.connexion()) else: m_paiement = self.adhesion() if (m_paiement > time.time()) or (config.periode_transitoire and config.debut_periode_transitoire <= m_paiement <= config.fin_periode_transitoire): - if config.periode_transitoire or not isinstance(self, Adherent) or not config.bl_carte_et_definitif or bool(self.carteEtudiant()): - return True - else: - return self.sursis_carte() + return True else: return False @@ -2020,18 +2004,8 @@ class BaseProprietaire(BaseClasseCrans): else: ret += coul(u"Modification %s effectuée avec succès." % self.Nom(), 'vert') - # Changements administratifs - test_carte = 'carteEtudiant' in self.modifs - if test_carte: - ret += coul('\n%s\n' % ('-'* 78), 'rouge') - ret += coul(u"Merci d'indiquer son aid (%s) en haut à gauche de la photocopie de la carte d'étudiant" % self.id(), 'gras') - ret += coul('\n%s\n' % ('-'* 78), 'rouge') - - if test_carte and self.machines(): - self.services_to_restart('bl_carte_etudiant') - - if 'paiement' in self.modifs or (config.bl_carte_et_definitif and test_carte): + if any([kw in self.modifs for kw in ['finConnexion', 'finAdhesion']]): for m in self.machines(): self.services_to_restart('macip', [m.ip()] ) #self.services_to_restart('classify', [m.ip()] )