[lc_ldap] Ajout d'une méthode carte_ok pour carte étudiant et blackliste virtuelles pour carte étudiant et chambre invalides
This commit is contained in:
parent
42ebecd9ca
commit
a06b40b4e0
1 changed files with 25 additions and 1 deletions
26
lc_ldap.py
26
lc_ldap.py
|
@ -453,8 +453,18 @@ class CransLdapObject(object):
|
|||
- Proposer de filtrer les blacklistes avec un arg supplémentaire ?
|
||||
- Vérifier les blacklistes des machines pour les adhérents ?
|
||||
"""
|
||||
blacklist_liste=[]
|
||||
# blacklistes virtuelle si on est un adhérent pour carte étudiant et chambre invalides
|
||||
if self.__class__.__name__ == "adherent" and self.paiement_ok():
|
||||
if not config.periode_transitoire and config.bl_carte_et_actif and not self.carte_ok():
|
||||
bl = blacklist(u'%s$%s$%s$%s' % ('-', '-', 'carte_etudiant', ''), {}, self.conn, False)
|
||||
blacklist_liste.append(bl)
|
||||
if self['chbre'][0].value == '????':
|
||||
bl = blacklist(u'%s$%s$%s$%s' % ('-', '-', 'chambre_invalide', ''), {}, self.conn, False)
|
||||
blacklist_liste.append(bl)
|
||||
attrs = (self.attrs if self.mode not in ["w", "rw"] else self._modifs)
|
||||
return filter((lambda bl: bl.is_actif()), attrs.get("blacklist",[]))
|
||||
blacklist_liste.extend(filter((lambda bl: bl.is_actif()), attrs.get("blacklist",[])))
|
||||
return blacklist_liste
|
||||
|
||||
def blacklist(self, sanction, commentaire, debut="now", fin = '-'):
|
||||
u"""
|
||||
|
@ -506,6 +516,20 @@ class proprio(CransLdapObject):
|
|||
pass
|
||||
return bool_carte and bool_paiement
|
||||
return bool_paiement
|
||||
|
||||
def carte_ok(self):
|
||||
u"""Renvoie si le propriétaire a donné sa carte pour l'année en cours"""
|
||||
if not self.dn == base_dn and config.bl_carte_et_actif and not 'club' in map(lambda x:x.value,self["objectClass"]):
|
||||
bool_carte = False
|
||||
try:
|
||||
for carte in self['carteEtudiant']:
|
||||
if carte.value == config.ann_scol:
|
||||
bool_carte = True
|
||||
except KeyError:
|
||||
pass
|
||||
return bool_carte
|
||||
return True
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue