diff --git a/attributs.py b/attributs.py index 4677680..2a5a450 100644 --- a/attributs.py +++ b/attributs.py @@ -458,6 +458,15 @@ class uid(Attr): unique = True ldap_name = "uid" +@crans_attribute +class preferedLanguage(Attr): + singlevalue = True + option = True + legend = u"La langue préférée de l'adhérent" + category = 'perso' + unique = False + ldap_name = "preferedLanguage" + @crans_attribute class nom(Attr): singlevalue = True @@ -533,12 +542,15 @@ class paiement(yearAttr): ldap_name = "paiement" @crans_attribute -class carteEtudiant(yearAttr): +class carteEtudiant(Attr): legend = u"Carte d'étudiant" category = 'perso' can_modify = [cableur, nounou, tresorier] ldap_name = "carteEtudiant" + def parse_value(self, data): + self.value = data + @crans_attribute class derniereConnexion(intAttr): legend = u"Dernière connexion" @@ -567,7 +579,7 @@ class mail(Attr): modifiables = list(modifiables) for droit in self.parent.get('droits', []): - if droit not in modifiables: + if droit not in modifiables and droit in TOUS_DROITS: return False return super(mail, self).is_modifiable(liste_droits) @@ -1144,7 +1156,12 @@ class blacklist(Attr): else: raise ValueError("A blacklist should contain the following keys : 'debut', 'fin', 'type', 'comm'") else: - bl_debut, bl_fin, bl_type, bl_comm = blacklist.split('$') + try: + bl_debut, bl_fin, bl_type, bl_comm = blacklist.split('$') + except: + print "valeur = %s" % blacklist + raise + now = time.time() self.value = { 'debut' : bl_debut if bl_debut == '-' else int (bl_debut), 'fin' : bl_fin if bl_fin == '-' else int(bl_fin), @@ -1319,7 +1336,7 @@ class userPassword(Attr): modifiables = list(modifiables) for droit in self.parent.get('droits', []): - if droit not in modifiables: + if droit not in modifiables and droit in TOUS_DROITS: return False return super(userPassword, self).is_modifiable(liste_droits) diff --git a/objets.py b/objets.py index 63c3440..4df1add 100644 --- a/objets.py +++ b/objets.py @@ -813,6 +813,12 @@ class proprio(CransLdapObject): else: raise EnvironmentError("L'adhérent n'a pas de compte crans") + + def solde(self, operation, comment): + self['historique'].append(comment) + raise EnvironmentError("Il faut implémenter des locks sur le solde avant d'écrire la fonction solde dans la classe proprio de lc_ldap") + + def may_be(self, what, liste=None): """Teste si liste peut faire ce qui est dans what, pour what élément de {create, delete, modify}. @@ -1165,7 +1171,7 @@ class club(proprio): ldap_name = "club" def __repr__(self): - return str(self.__class__) + " : cid=" + str(self['cid'][0]) + return "Club : " + str(self['nom'][0]) @crans_object class machineFixe(machine):