[lc_ldap] corrections
This commit is contained in:
parent
a36bafa021
commit
5f3c3d56fb
3 changed files with 81 additions and 24 deletions
61
attributs.py
61
attributs.py
|
@ -33,6 +33,12 @@
|
|||
import re
|
||||
from unicodedata import normalize
|
||||
|
||||
def normalize_and_validate(attr, vals, ctxt):
|
||||
"""Vérifie que attr peut se voir attribuer les valeurs vals"""
|
||||
a = eval('%s()' % attr)
|
||||
new_vals = a.normalize(vals, ctxt)
|
||||
a.validate(new_vals, ctxt)
|
||||
return new_vals
|
||||
|
||||
def validate_name(value, more_chars=""):
|
||||
"""Valide un nom: ie un unicode qui contient lettres, espaces et
|
||||
|
@ -49,6 +55,9 @@ class Attr:
|
|||
singlevalue = None
|
||||
optional = None
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def validate(self, values, uldif):
|
||||
"validates"
|
||||
self._check_cardinality(values)
|
||||
|
@ -94,6 +103,12 @@ class Attr:
|
|||
"""Vérifie si l'attribut est modifiable"""
|
||||
return False
|
||||
|
||||
|
||||
class objectClass(Attr):
|
||||
singlevalue = False
|
||||
optional = False
|
||||
legend = "entité"
|
||||
|
||||
class nom(Attr):
|
||||
singlevalue = True
|
||||
optional = False
|
||||
|
@ -166,6 +181,23 @@ class solde(Attr):
|
|||
legend = u"Solde d'impression"
|
||||
|
||||
|
||||
class host(Attr):
|
||||
singlevalue = True
|
||||
optional = False
|
||||
hname = legend = u"Nom d'hôte"
|
||||
|
||||
class macAddress(Attr):
|
||||
singlevalue = True
|
||||
optional = False
|
||||
legend = u"Adresse physique de la carte réseau"
|
||||
hname = "Adresse MAC"
|
||||
|
||||
class ipHostNumber(Attr):
|
||||
singlevalue = True
|
||||
optional = False
|
||||
legend = u"Adresse IPv4 de la machine"
|
||||
hname = "IPv4"
|
||||
|
||||
class mid(Attr):
|
||||
singlevalue = True
|
||||
optional = False
|
||||
|
@ -238,3 +270,32 @@ class historique(Attr):
|
|||
legend = u"Historique de l'objet"
|
||||
|
||||
|
||||
CRANS_ATTRIBUTES= {
|
||||
'objectClass' : objectClass(),
|
||||
'nom' : nom(),
|
||||
'prenom' : prenom(),
|
||||
'tel' : tel(),
|
||||
'paiement' : paiement(),
|
||||
'carteEtudiant' : carteEtudiant(),
|
||||
'mailAlias' : mailAlias(),
|
||||
'canonicalAlias' : canonicalAlias(),
|
||||
'etudes' : etudes(),
|
||||
'chbre' : chbre(),
|
||||
'droits' : droits(),
|
||||
'solde' : solde(),
|
||||
'mid' : mid(),
|
||||
'hostAlias' : hostAlias(),
|
||||
'ipsec' : ipsec(),
|
||||
'puissance' : puissance(),
|
||||
'canal' : canal(),
|
||||
'portTCPout' : portTCPout(),
|
||||
'portTCPin' : portTCPin(),
|
||||
'portUDPout' : portUDPout(),
|
||||
'portUDPin' : portUDPin(),
|
||||
'prise' : prise(),
|
||||
'cid' : cid(),
|
||||
'responsable' : responsable(),
|
||||
'blacklist' : blacklist(),
|
||||
'historique' : historique()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue