[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
34
objets.py
34
objets.py
|
@ -448,14 +448,15 @@ class CransLdapObject(object):
|
||||||
"""
|
"""
|
||||||
blacklist_liste=[]
|
blacklist_liste=[]
|
||||||
# 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 self.__class__.__name__ == "adherent" and self.paiement_ok():
|
if isinstance(self, adherent):
|
||||||
if not config.periode_transitoire and config.bl_carte_et_actif and not self.carte_ok() and not self.sursis_carte():
|
if not self.carte_ok():
|
||||||
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'carte_etudiant', ''), {}, self.conn)
|
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'carte_etudiant', ''), {}, self.conn)
|
||||||
blacklist_liste.append(bl)
|
blacklist_liste.append(bl)
|
||||||
if self['chbre'][0].value == '????':
|
if self['chbre'][0].value == '????':
|
||||||
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'chambre_invalide', ''), {}, self.conn)
|
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'chambre_invalide', ''), {}, self.conn)
|
||||||
blacklist_liste.append(bl)
|
blacklist_liste.append(bl)
|
||||||
elif self.__class__.__name__ == "adherent":
|
if isinstance(self, proprio):
|
||||||
|
if not self.paiement_ok():
|
||||||
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'paiement', ''), {}, self.conn)
|
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'paiement', ''), {}, self.conn)
|
||||||
blacklist_liste.append(bl)
|
blacklist_liste.append(bl)
|
||||||
attrs = (self.attrs if self.mode not in ["w", "rw"] else self._modifs)
|
attrs = (self.attrs if self.mode not in ["w", "rw"] else self._modifs)
|
||||||
|
@ -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 ((time.time()-time.mktime(time.strptime(x.group(1),'%d/%m/%Y %H:%M'))) <= config.sursis_carte)
|
||||||
return False
|
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):
|
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:
|
if self.dn == variables.base_dn:
|
||||||
return True
|
return True
|
||||||
bool_paiement = False
|
bool_paiement = False
|
||||||
|
@ -552,25 +558,11 @@ class proprio(CransLdapObject):
|
||||||
break
|
break
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
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"]):
|
|
||||||
bool_carte = False
|
|
||||||
try:
|
|
||||||
for carte in self['carteEtudiant']:
|
|
||||||
if carte.value == config.ann_scol:
|
|
||||||
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
|
return bool_paiement
|
||||||
|
|
||||||
def carte_ok(self):
|
def carte_ok(self):
|
||||||
u"""Renvoie si le propriétaire a donné sa carte pour l'année en cours"""
|
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 config.bl_carte_et_actif and not 'club' in map(lambda x:x.value,self["objectClass"]):
|
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
|
bool_carte = False
|
||||||
try:
|
try:
|
||||||
for carte in self['carteEtudiant']:
|
for carte in self['carteEtudiant']:
|
||||||
|
@ -578,6 +570,8 @@ class proprio(CransLdapObject):
|
||||||
bool_carte = True
|
bool_carte = True
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
if not bool_carte and self.sursis_carte():
|
||||||
|
bool_carte = True
|
||||||
return bool_carte
|
return bool_carte
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue