LDAPObject: fixed a bug in python <-> ldap attributes conversion.

This should fix the CI.
This commit is contained in:
Éloi Rivard 2022-11-14 18:11:35 +01:00
parent 221f4615e3
commit 660b143b45
2 changed files with 9 additions and 2 deletions

View file

@ -13,6 +13,7 @@ Fixed
the LDAP schema update of 0.0.12
- Fixed a bug happening during RP initiated logout on clients without
`post_logout_redirect_uri` defined.
- Gitlab CI fix. :pr:`64`
Added
*****

View file

@ -170,7 +170,10 @@ class LDAPObject:
@staticmethod
def ldap_to_python(name, value):
try:
syntax = LDAPObject.ldap_object_attributes()[name].syntax
except KeyError:
return value
if syntax == "1.3.6.1.4.1.1466.115.121.1.24": # Generalized Time
value = value.decode("utf-8")
@ -189,7 +192,10 @@ class LDAPObject:
@staticmethod
def python_to_ldap(name, value):
try:
syntax = LDAPObject.ldap_object_attributes()[name].syntax
except KeyError:
return value
if syntax == "1.3.6.1.4.1.1466.115.121.1.24": # Generalized Time
return value.strftime("%Y%m%d%H%M%SZ").encode("utf-8")