Merge branch 'master' of sila:/git/ldap
This commit is contained in:
commit
ac4b0854b5
1 changed files with 10 additions and 7 deletions
17
lc_ldap.py
17
lc_ldap.py
|
@ -44,15 +44,16 @@ base_dn = 'ou=data,dc=crans,dc=org'
|
|||
|
||||
def is_actif(sanction):
|
||||
"""Retourne True ou False suivant si la sanction fournie (chaîne
|
||||
venant de blacklist) est active ou non
|
||||
venant de blacklist) est active ou non.
|
||||
La blacklist est de la forme "debut$fin$..."
|
||||
"""
|
||||
bl = sanction.split('$')
|
||||
bl_debut, bl_fin, _ = sanction.split('$', 3)
|
||||
now = time.time()
|
||||
debut = int(bl[0])
|
||||
if bl[1] == '-':
|
||||
debut = int(bl_debut)
|
||||
if bl_fin == '-':
|
||||
fin = now + 1
|
||||
else:
|
||||
fin = int(bl[1])
|
||||
fin = int(bl_fin)
|
||||
return debut < now and fin > now
|
||||
|
||||
def uldif_to_ldif(uldif):
|
||||
|
@ -87,6 +88,7 @@ def cldif_to_ldif(cldif):
|
|||
|
||||
|
||||
def lc_ldap_test():
|
||||
"""Binding LDAP à la base de tests"""
|
||||
return lc_ldap(dn='cn=admin,dc=crans,dc=org', cred='75bdb64f32')
|
||||
|
||||
class lc_ldap(ldap.ldapobject.LDAPObject):
|
||||
|
@ -227,7 +229,7 @@ class lc_ldap(ldap.ldapobject.LDAPObject):
|
|||
|
||||
|
||||
|
||||
class CransLdapObject:
|
||||
class CransLdapObject(object):
|
||||
mode = 'ro'
|
||||
|
||||
attrs = None # Contient un dico uldif qui doit représenter ce qui
|
||||
|
@ -494,7 +496,8 @@ class CransLdapObject:
|
|||
class proprio(CransLdapObject):
|
||||
ufields = [ 'nom', 'chbre' ]
|
||||
mfields = [ 'paiement', 'info', 'blacklist', 'controle']
|
||||
ofields = []; xfields = []
|
||||
ofields = []
|
||||
xfields = []
|
||||
_machines = None
|
||||
def machines(self):
|
||||
if self._machines == None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue