[paiement_ok/carte_ok/access_ok] paiement ne s'occupe que du paiement, introduction de access_ok
This commit is contained in:
parent
7808221099
commit
3cc010d180
1 changed files with 17 additions and 23 deletions
40
objets.py
40
objets.py
|
@ -448,16 +448,17 @@ class CransLdapObject(object):
|
|||
"""
|
||||
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() and not self.sursis_carte():
|
||||
if isinstance(self, adherent):
|
||||
if not self.carte_ok():
|
||||
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'carte_etudiant', ''), {}, self.conn)
|
||||
blacklist_liste.append(bl)
|
||||
if self['chbre'][0].value == '????':
|
||||
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'chambre_invalide', ''), {}, self.conn)
|
||||
blacklist_liste.append(bl)
|
||||
elif self.__class__.__name__ == "adherent":
|
||||
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'paiement', ''), {}, self.conn)
|
||||
blacklist_liste.append(bl)
|
||||
if isinstance(self, proprio):
|
||||
if not self.paiement_ok():
|
||||
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'paiement', ''), {}, self.conn)
|
||||
blacklist_liste.append(bl)
|
||||
attrs = (self.attrs if self.mode not in ["w", "rw"] else self._modifs)
|
||||
blacklist_liste.extend(filter((lambda bl: bl.is_actif()), attrs.get("blacklist",[])))
|
||||
if excepts:
|
||||
|
@ -536,8 +537,13 @@ class proprio(CransLdapObject):
|
|||
return ((time.time()-time.mktime(time.strptime(x.group(1),'%d/%m/%Y %H:%M'))) <= config.sursis_carte)
|
||||
return False
|
||||
|
||||
def access_ok(self):
|
||||
u"""Renvoie si le propriétaire a payé et donné sa carte pour l'année en cours"""
|
||||
return self.paiement_ok() and self.carte_ok()
|
||||
|
||||
|
||||
def paiement_ok(self):
|
||||
u"""Renvoie si le propriétaire a payé pour l'année en cours"""
|
||||
u"""Renvoie si le propriétaire a payé pour l'année en cours, en prenant en compte les périodes de transition"""
|
||||
if self.dn == variables.base_dn:
|
||||
return True
|
||||
bool_paiement = False
|
||||
|
@ -552,9 +558,11 @@ class proprio(CransLdapObject):
|
|||
break
|
||||
except KeyError:
|
||||
pass
|
||||
# Doit-on bloquer en cas de manque de la carte d'etudiant ?
|
||||
# (si période transitoire on ne bloque dans aucun cas)
|
||||
if not config.periode_transitoire and config.bl_carte_et_definitif and not 'club' in map(lambda x:x.value,self["objectClass"]):
|
||||
return bool_paiement
|
||||
|
||||
def carte_ok(self):
|
||||
u"""Renvoie si le propriétaire a donné sa carte pour l'année en cours, en prenant en compte les periode transitoires et le sursis carte"""
|
||||
if not self.dn == variables.base_dn and not config.periode_transitoire 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']:
|
||||
|
@ -562,22 +570,8 @@ class proprio(CransLdapObject):
|
|||
bool_carte = True
|
||||
except KeyError:
|
||||
pass
|
||||
# Si inscrit depuis moins de config.sursis_carte, on laisse un sursis
|
||||
if not bool_carte and self.sursis_carte():
|
||||
bool_carte = True
|
||||
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 == variables.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