Droppe ce qui concerne la carte d'étudiant, et les blacklistes obsolètes.
This commit is contained in:
parent
1c205fca93
commit
a09ef77d22
4 changed files with 36 additions and 92 deletions
|
@ -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"))
|
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"))
|
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 pour les inscription après le 1/11 pour fournir la carte étudiant
|
||||||
sursis_carte=8*24*3600
|
sursis_carte=8*24*3600
|
||||||
|
|
||||||
|
@ -415,29 +407,35 @@ file_pickle = { 4 : '/tmp/ipt_pickle',
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
#: Items de la blackliste
|
#: Items de la blackliste
|
||||||
blacklist_items = { u'bloq': u'Blocage total de tous les services',
|
blacklist_items = {
|
||||||
u'carte_etudiant': u'Carte etudiant manquante',
|
u'bloq': u'Blocage total de tous les services',
|
||||||
u'paiement': u'Paiement manquant cette année',
|
u'paiement': u'Paiement manquant cette année',
|
||||||
u'virus': u'Passage en VLAN isolement',
|
u'virus': u'Passage en VLAN isolement',
|
||||||
u'upload': u"Bridage du débit montant vers l'extérieur",
|
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_upload': u'Autodisconnect pour upload',
|
||||||
u'autodisc_virus': u'Autodisconnect pour virus',
|
u'ipv6_ra': u'Isolement pour RA',
|
||||||
u'autodisc_upload': u'Autodisconnect pour upload',
|
u'mail_invalide': u'Blocage pour mail invalide',
|
||||||
u'autodisc_p2p': u'Autodisconnect pour P2P',
|
u'warez' : u"Présence de contenu violant de droit d'auteur sur zamok",
|
||||||
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
|
#: Blacklistes entrainant une déconnexion complète
|
||||||
blacklist_sanctions = ['warez', 'p2p', 'autodisc_p2p','autodisc_virus','virus', 'bloq',
|
blacklist_sanctions = [
|
||||||
|
'warez',
|
||||||
|
'virus',
|
||||||
|
'bloq',
|
||||||
'paiement',
|
'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)
|
#: Blacklistes redirigeant le port 80 en http vers le portail captif (avec des explications)
|
||||||
blacklist_sanctions_soft = ['autodisc_virus','ipv6_ra','mail_invalide','virus',
|
blacklist_sanctions_soft = [
|
||||||
'warez', 'p2p', 'autodisc_p2p', 'bloq','carte_etudiant','chambre_invalide']
|
'ipv6_ra',
|
||||||
|
'mail_invalide',
|
||||||
|
'virus',
|
||||||
|
'warez',
|
||||||
|
'bloq',
|
||||||
|
'chambre_invalide',
|
||||||
|
]
|
||||||
|
|
||||||
#: Blacklistes entrainant un bridage de la connexion pour upload
|
#: Blacklistes entrainant un bridage de la connexion pour upload
|
||||||
blacklist_bridage_upload = ['autodisc_upload', 'upload']
|
blacklist_bridage_upload = ['autodisc_upload', 'upload']
|
||||||
|
|
||||||
|
|
|
@ -45,17 +45,13 @@ class base_reconfigure:
|
||||||
'macip': [ _s + '-macip' for _s in __firewalled_servers ],
|
'macip': [ _s + '-macip' for _s in __firewalled_servers ],
|
||||||
# 'droits': [ 'rouge-droits', 'ragnarok-droits' ],
|
# 'droits': [ 'rouge-droits', 'ragnarok-droits' ],
|
||||||
'blacklist': __blacklist_servers,
|
'blacklist': __blacklist_servers,
|
||||||
'bl_carte_etudiant': __blacklist_servers,
|
|
||||||
'bl_chbre_invalide': __blacklist_servers,
|
'bl_chbre_invalide': __blacklist_servers,
|
||||||
'blacklist_mail_invalide': __blacklist_servers,
|
'blacklist_mail_invalide': __blacklist_servers,
|
||||||
'blacklist_virus': __blacklist_servers,
|
'blacklist_virus': __blacklist_servers,
|
||||||
'blacklist_warez': __blacklist_servers,
|
'blacklist_warez': __blacklist_servers,
|
||||||
'blacklist_ipv6_ra': __blacklist_servers,
|
'blacklist_ipv6_ra': __blacklist_servers,
|
||||||
'blacklist_upload': __blacklist_servers,
|
'blacklist_upload': __blacklist_servers,
|
||||||
'blacklist_p2p': __blacklist_servers,
|
|
||||||
'blacklist_autodisc_virus': __blacklist_servers,
|
|
||||||
'blacklist_autodisc_upload': __blacklist_servers,
|
'blacklist_autodisc_upload': __blacklist_servers,
|
||||||
'blacklist_autodisc_p2p': __blacklist_servers,
|
|
||||||
'blacklist_bloq': __blacklist_servers,
|
'blacklist_bloq': __blacklist_servers,
|
||||||
'del_user': [ 'zbee-del_user', 'owl-del_user', 'zamok-del_user' ],
|
'del_user': [ 'zbee-del_user', 'owl-del_user', 'zamok-del_user' ],
|
||||||
'port': ['%s-port' % _s for _s in __services.get('connection-main', [])],
|
'port': ['%s-port' % _s for _s in __services.get('connection-main', [])],
|
||||||
|
|
|
@ -1403,30 +1403,18 @@ def set_admin(proprio):
|
||||||
Définition de l'état administratif : carte d'étudiant et paiement.
|
Définition de l'état administratif : carte d'étudiant et paiement.
|
||||||
"""
|
"""
|
||||||
# Le proprietaire a-t-il une section carte d'étudiant (pas les clubs) ?
|
# 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
|
# Initialisation des différentes checkbox
|
||||||
carte = on_off(proprio.carteEtudiant())
|
if potential_ma:
|
||||||
carte_ok = on_off('c' in proprio.controle())
|
charte_MA = on_off(proprio.charteMA())
|
||||||
if has_card: charte_MA = on_off(proprio.charteMA())
|
|
||||||
|
|
||||||
# Construction de la boîte de dialogue
|
# Construction de la boîte de dialogue
|
||||||
texte = []
|
texte = []
|
||||||
checklist = []
|
checklist = []
|
||||||
|
|
||||||
if has_card:
|
if (isbureau or isadm) and potential_ma:
|
||||||
if carte_ok == 'off' or iscontroleur:
|
checklist.append(u'"1" "Charte des MA signee" "%s"' % charte_MA)
|
||||||
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 not checklist:
|
if not checklist:
|
||||||
# Il n'y a rien de modifiable
|
# Il n'y a rien de modifiable
|
||||||
|
@ -1434,7 +1422,6 @@ def set_admin(proprio):
|
||||||
(proprio.Nom(), '\n'.join(texte)))
|
(proprio.Nom(), '\n'.join(texte)))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
# Il y a qqch de modifiable, on construit la checklist
|
# Il y a qqch de modifiable, on construit la checklist
|
||||||
arg = u'--title "Etat administratif de %s" ' % proprio.Nom()
|
arg = u'--title "Etat administratif de %s" ' % proprio.Nom()
|
||||||
arg += u'--separate-output '
|
arg += u'--separate-output '
|
||||||
|
@ -1444,21 +1431,10 @@ def set_admin(proprio):
|
||||||
annul, result = dialog(arg)
|
annul, result = dialog(arg)
|
||||||
if annul: return 1
|
if annul: return 1
|
||||||
|
|
||||||
# Traitement
|
if potential_ma and (isadm or isbureau):
|
||||||
if has_card:
|
|
||||||
if '1' in result:
|
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)
|
proprio.charteMA(True)
|
||||||
elif isadm or isbureau:
|
else:
|
||||||
proprio.charteMA(False)
|
proprio.charteMA(False)
|
||||||
|
|
||||||
def set_adhesion(proprio):
|
def set_adhesion(proprio):
|
||||||
|
@ -2179,7 +2155,7 @@ def modif_adher(adher):
|
||||||
arg += u'--menu "Que souhaitez vous modifier ?" 0 0 0 '
|
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'"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'"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" '
|
arg += u'"Etat-civil" "Nom, prénom" '
|
||||||
if adher.chbre() == 'EXT':
|
if adher.chbre() == 'EXT':
|
||||||
arg += u'"Adresse" "Déménagement" '
|
arg += u'"Adresse" "Déménagement" '
|
||||||
|
@ -2661,7 +2637,7 @@ def menu_principal():
|
||||||
arg += u'"" "---------------------------------------" "" '
|
arg += u'"" "---------------------------------------" "" '
|
||||||
|
|
||||||
arg += u'"aA" "Inscrire un nouvel adhérent" "" '
|
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'"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'"dA" "Détruire un adhérent" "Suppression de l\'adhérent ainsi que de ses machines" '
|
||||||
arg += u'"" "---------------------------------------" "" '
|
arg += u'"" "---------------------------------------" "" '
|
||||||
|
|
|
@ -774,8 +774,6 @@ class CransLdap:
|
||||||
el = "(|(paiement=%s)(finAdhesion>=%s))" % (config.ann_scol, generalizedTimeFormat(time.time()))
|
el = "(|(paiement=%s)(finAdhesion>=%s))" % (config.ann_scol, generalizedTimeFormat(time.time()))
|
||||||
# Doit-on bloquer en cas de manque de la carte d'etudiant ?
|
# Doit-on bloquer en cas de manque de la carte d'etudiant ?
|
||||||
# (si période transitoire on ne bloque dans aucun cas)
|
# (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':
|
elif champ[1:] == 'blacklist':
|
||||||
el = '(blacklist=%s)' % expr
|
el = '(blacklist=%s)' % expr
|
||||||
else:
|
else:
|
||||||
|
@ -1064,8 +1062,6 @@ class BaseClasseCrans(CransLdap):
|
||||||
|
|
||||||
elif isinstance(self, Adherent) and (self.adhesion() > time.time() and self.connexion() > time.time()):
|
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
|
# 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() == '????':
|
if self.chbre() == '????':
|
||||||
actifs['chambre_invalide']=('-','-')
|
actifs['chambre_invalide']=('-','-')
|
||||||
|
|
||||||
|
@ -1260,7 +1256,7 @@ class BaseClasseCrans(CransLdap):
|
||||||
valeur_finale)
|
valeur_finale)
|
||||||
|
|
||||||
# Formate les entrées de l'historique de la forme champ+diff-diff
|
# 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',
|
'mailAlias', 'hostAlias', 'exempt', 'nvram',
|
||||||
'portTCPin', 'portTCPout', 'portUDPin', 'portUDPout',
|
'portTCPin', 'portTCPout', 'portUDPin', 'portUDPout',
|
||||||
'homepageAlias', 'imprimeurClub', 'gpgFingerprint',
|
'homepageAlias', 'imprimeurClub', 'gpgFingerprint',
|
||||||
|
@ -1939,25 +1935,13 @@ class BaseProprietaire(BaseClasseCrans):
|
||||||
self._set('uidNumber', [new])
|
self._set('uidNumber', [new])
|
||||||
return 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):
|
def paiement_ok(self):
|
||||||
if isinstance(self, Adherent):
|
if isinstance(self, Adherent):
|
||||||
m_paiement = min(self.adhesion(), self.connexion())
|
m_paiement = min(self.adhesion(), self.connexion())
|
||||||
else:
|
else:
|
||||||
m_paiement = self.adhesion()
|
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 (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
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return self.sursis_carte()
|
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -2020,18 +2004,8 @@ class BaseProprietaire(BaseClasseCrans):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
ret += coul(u"Modification %s effectuée avec succès." % self.Nom(), 'vert')
|
ret += coul(u"Modification %s effectuée avec succès." % self.Nom(), 'vert')
|
||||||
# Changements administratifs
|
|
||||||
test_carte = 'carteEtudiant' in self.modifs
|
|
||||||
|
|
||||||
if test_carte:
|
if any([kw in self.modifs for kw in ['finConnexion', 'finAdhesion']]):
|
||||||
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):
|
|
||||||
for m in self.machines():
|
for m in self.machines():
|
||||||
self.services_to_restart('macip', [m.ip()] )
|
self.services_to_restart('macip', [m.ip()] )
|
||||||
#self.services_to_restart('classify', [m.ip()] )
|
#self.services_to_restart('classify', [m.ip()] )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue