Merge branch 'master' of ssh://git.crans.org/git/ldap

This commit is contained in:
Daniel STAN 2013-01-15 18:54:38 +01:00
commit be6b378bf8
3 changed files with 22 additions and 3 deletions

View file

@ -102,7 +102,9 @@ class Attr(object):
def validate(self, ldif):
"""validates:
vérifie déjà que ce qu'on a rentré est parsable"""
own_values = ldif[self.__class__.__name__]
if not self.__class__.__name__ in CRANS_ATTRIBUTES:
raise ValueError('Attribut %s inconnu' % self.__class__.__name__)
own_values = ldif.get(self.__class__.__name__, [])
self._check_cardinality(own_values)
self._check_uniqueness()
self._check_users_restrictions(own_values)
@ -647,6 +649,18 @@ class mail(Attr):
# XXX - to be implemented
#def parse_value(self, mail, ldif):
# pass
class sshFingerprint(Attr):
singlevalue = False
optional = True
legend = "Clef ssh de la machine"
can_modify = ["parent", "Nounou"]
class gpgFingerprint(Attr):
singlevalue = False
optional = True
legend = "Clef gpg d'un adhérent"
can_modify = ["self", "Nounou"]
class cn(Attr):
singlevalue = True
@ -699,8 +713,10 @@ CRANS_ATTRIBUTES= {
'chbre' : chbre,
'droits' : droits,
'solde' : solde,
'gpgFingerprint' : gpgFingerprint,
'mid' : mid,
'host' : host,
'sshFingerprint' : sshFingerprint,
'macAddress': macAddress,
'ipHostNumber': ipHostNumber,
'hostAlias' : hostAlias,

View file

@ -232,6 +232,8 @@ def human_to_ldap(filtre):
# Comme parenthèse fermante.
if neg:
argument = "!(%s)" % argument
# Surtout ça
if operateur == "&|":
argument += ')'
ext_stack += "(%s)" % argument

View file

@ -10,6 +10,7 @@
# Valentin Samir <samir@crans.org>
# Daniel Stan <dstan@crans.org>
# Vincent Le Gallic <legallic@crans.org>
# Pierre-Elliott Bécue <becue@crans.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@ -627,7 +628,7 @@ class machine(CransLdapObject):
ufields = ['mid', 'macAddress', 'host', 'midType']
ofields = []
mfields = ['info', 'blacklist', 'hostAlias', 'exempt',
'portTCPout', 'portTCPin', 'portUDPout', 'portUDPin']
'portTCPout', 'portTCPin', 'portUDPout', 'portUDPin','sshFingerprint']
xfields = ['ipHostNumber']
def __init__(self, conn, dn, mode='ro', ldif = None):
@ -662,7 +663,7 @@ class adherent(proprio):
ofields = proprio.ofields + ['charteMA',
'canonicalAlias', 'solde', 'contourneGreylist',
'rewriteMailHeaders', 'derniereConnexion',
'homepageAlias']
'homepageAlias','gpgFingerprint']
mfields = proprio.mfields + ['carteEtudiant', 'mailAlias', 'droits' ]
xfields = ['etudes', 'postalAddress']