diff --git a/attributs.py b/attributs.py index 8be7a3e..8293259 100644 --- a/attributs.py +++ b/attributs.py @@ -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, diff --git a/filter.py b/filter.py index 8b0171f..42b1a35 100644 --- a/filter.py +++ b/filter.py @@ -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 diff --git a/lc_ldap.py b/lc_ldap.py index 8d8a241..21c2fc4 100644 --- a/lc_ldap.py +++ b/lc_ldap.py @@ -10,6 +10,7 @@ # Valentin Samir # Daniel Stan # Vincent Le Gallic +# Pierre-Elliott Bécue # # 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']