1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 01:14:21 +01:00

more complete content for self.backend_attributes in attributes class

* pass additional information in a dictionary (the type)
* manage multiple declaration of a given backend attribute (content
could be lists, not only a lonely string)
This commit is contained in:
kakwa 2019-02-26 23:55:43 +01:00
parent 245bafb01c
commit 3c9bc8a0ac

View File

@ -61,9 +61,27 @@ class Attributes:
self.key = attrid self.key = attrid
for b in attr['backends']: for b in attr['backends']:
self.backends.add(b) self.backends.add(b)
backend_attr = attr['backends'][b]
if b not in self.backend_attributes: if b not in self.backend_attributes:
self.backend_attributes[b] = {} self.backend_attributes[b] = {}
self.backend_attributes[b][attr['backends'][b]] = attrid if backend_attr in self.backend_attributes[b]:
if type(self.backend_attributes[b][backend_attr]) \
is not list:
self.backend_attributes[b][backend_attr] = [
self.backend_attributes[b][backend_attr],
]
self.backend_attributes[b][backend_attr].append(
{
'id':attrid,
'type': attr['type']
}
)
else:
self.backend_attributes[b][backend_attr] = {
'id':attrid,
'type': attr['type']
}
if 'search_displayed' in attr and attr['search_displayed']: if 'search_displayed' in attr and attr['search_displayed']:
self.displayed_attributes[attrid] = attr self.displayed_attributes[attrid] = attr