Alias mail pour les clubs + affichage des infos de compte dans le whos.
darcs-hash:20041127192523-41617-65a789aea75bc5925456fd4131c678fb3837f1fb.gz
This commit is contained in:
parent
cb2924c574
commit
08d91ae155
2 changed files with 58 additions and 50 deletions
|
@ -970,6 +970,54 @@ class base_proprietaire(base_classes_crans) :
|
||||||
self._init_data={}
|
self._init_data={}
|
||||||
self._modifiable = 'w'
|
self._modifiable = 'w'
|
||||||
|
|
||||||
|
def alias(self,new=None) :
|
||||||
|
"""
|
||||||
|
Création ou visualisation des alias mail
|
||||||
|
Même sytème d'argument que la méthode info.
|
||||||
|
"""
|
||||||
|
if not self._data.has_key('mailAlias') :
|
||||||
|
self._data['mailAlias']=[]
|
||||||
|
liste = list(self._data['mailAlias'])
|
||||||
|
if new==None :
|
||||||
|
return map(decode,liste)
|
||||||
|
|
||||||
|
if type(new)==list :
|
||||||
|
# Modif
|
||||||
|
index = new[0]
|
||||||
|
new = new[1]
|
||||||
|
if new=='' :
|
||||||
|
# Supression alias
|
||||||
|
liste.pop(index)
|
||||||
|
self._set('mailAlias',liste)
|
||||||
|
return liste
|
||||||
|
else :
|
||||||
|
new = new.replace('@crans.org','')
|
||||||
|
index=-1
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
l, new = preattr(new)
|
||||||
|
new = new.lower()
|
||||||
|
if l<2 :
|
||||||
|
raise ValueError(u"Alias trop court.")
|
||||||
|
for c in new[:]:
|
||||||
|
if not c in (string.letters + string.digits + '-_.') :
|
||||||
|
raise ValueError(u"Alias : seuls les caractères alphanumériques, le -, le _ et le . sont autorisés." )
|
||||||
|
if new[0] not in string.letters :
|
||||||
|
raise ValueError(u"Le premier caractère de l'alias doit être alphabétique.")
|
||||||
|
if mailexist(new) :
|
||||||
|
raise ValueError(u"Alias existant ou correspondand à un compte.")
|
||||||
|
|
||||||
|
if index!=-1 :
|
||||||
|
liste[index]=new
|
||||||
|
else :
|
||||||
|
liste = liste + [ new ]
|
||||||
|
|
||||||
|
# Lock de mailAlias
|
||||||
|
self._locks.append(self.lock('mailAlias',new))
|
||||||
|
|
||||||
|
self._set('mailAlias',liste)
|
||||||
|
return liste
|
||||||
|
|
||||||
def machines(self) :
|
def machines(self) :
|
||||||
""" Retourne les machines (instances) appartenant à la classe """
|
""" Retourne les machines (instances) appartenant à la classe """
|
||||||
if self.id() :
|
if self.id() :
|
||||||
|
@ -1498,54 +1546,6 @@ class adherent(base_proprietaire) :
|
||||||
self._set('cannonicalAlias',[a])
|
self._set('cannonicalAlias',[a])
|
||||||
return a
|
return a
|
||||||
|
|
||||||
def alias(self,new=None) :
|
|
||||||
"""
|
|
||||||
Création ou visualisation des alias mail
|
|
||||||
Même sytème d'argument que la méthode info.
|
|
||||||
"""
|
|
||||||
if not self._data.has_key('mailAlias') :
|
|
||||||
self._data['mailAlias']=[]
|
|
||||||
liste = list(self._data['mailAlias'])
|
|
||||||
if new==None :
|
|
||||||
return map(decode,liste)
|
|
||||||
|
|
||||||
if type(new)==list :
|
|
||||||
# Modif
|
|
||||||
index = new[0]
|
|
||||||
new = new[1]
|
|
||||||
if new=='' :
|
|
||||||
# Supression alias
|
|
||||||
liste.pop(index)
|
|
||||||
self._set('mailAlias',liste)
|
|
||||||
return liste
|
|
||||||
else :
|
|
||||||
new = new.replace('@crans.org','')
|
|
||||||
index=-1
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
l, new = preattr(new)
|
|
||||||
new = new.lower()
|
|
||||||
if l<2 :
|
|
||||||
raise ValueError(u"Alias trop court.")
|
|
||||||
for c in new[:]:
|
|
||||||
if not c in (string.letters + string.digits + '-_.') :
|
|
||||||
raise ValueError(u"Alias : seuls les caractères alphanumériques, le -, le _ et le . sont autorisés." )
|
|
||||||
if new[0] not in string.letters :
|
|
||||||
raise ValueError(u"Le premier caractère de l'alias doit être alphabétique.")
|
|
||||||
if mailexist(new) :
|
|
||||||
raise ValueError(u"Alias existant ou correspondand à un compte.")
|
|
||||||
|
|
||||||
if index!=-1 :
|
|
||||||
liste[index]=new
|
|
||||||
else :
|
|
||||||
liste = liste + [ new ]
|
|
||||||
|
|
||||||
# Lock de mailAlias
|
|
||||||
self._locks.append(self.lock('mailAlias',new))
|
|
||||||
|
|
||||||
self._set('mailAlias',liste)
|
|
||||||
return liste
|
|
||||||
|
|
||||||
def droits(self,droits=None) :
|
def droits(self,droits=None) :
|
||||||
""" droits est la liste des droits à donner à l'utilisateur """
|
""" droits est la liste des droits à donner à l'utilisateur """
|
||||||
if droits==None :
|
if droits==None :
|
||||||
|
|
|
@ -393,7 +393,7 @@ def machine_details(machine) :
|
||||||
|
|
||||||
# Alias ?
|
# Alias ?
|
||||||
alias = machine.alias()
|
alias = machine.alias()
|
||||||
if machine.alias() :
|
if alias :
|
||||||
f += coul(u'Alias : ' ,'gras') + ', '.join(alias)
|
f += coul(u'Alias : ' ,'gras') + ', '.join(alias)
|
||||||
f+= '\n'
|
f+= '\n'
|
||||||
|
|
||||||
|
@ -507,6 +507,14 @@ def club_details(club) :
|
||||||
f += g
|
f += g
|
||||||
f += '\n'
|
f += '\n'
|
||||||
|
|
||||||
|
login = club.compte()
|
||||||
|
if login :
|
||||||
|
f += coul(u'Login : ','gras') + login
|
||||||
|
alias = club.alias()
|
||||||
|
if alias :
|
||||||
|
f += coul(u'\tAlias : ','gras') + ', '.join(alias)
|
||||||
|
f+= u'\n'
|
||||||
|
|
||||||
f += _blacklist(club)
|
f += _blacklist(club)
|
||||||
f += _info(club)
|
f += _info(club)
|
||||||
f += _hist(club)
|
f += _hist(club)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue