Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multivalued attributes #72

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ldapcherry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,11 @@ def _merge_user_attrs(self, attrs_backend, attrs_out, backend_name):
"""
for attr in attrs_backend:
if attr in self.attributes.backend_attributes[backend_name]:
attrid = self.attributes.backend_attributes[backend_name][attr]
attr_desc = self.attributes.backend_attributes[backend_name][attr]
if type(attr_desc) is list:
attrid = attr_desc[0]['id']
else:
attrid = attr_desc['id']
if attrid not in attrs_out:
attrs_out[attrid] = attrs_backend[attr]

Expand Down
20 changes: 19 additions & 1 deletion ldapcherry/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,27 @@ def __init__(self, attributes_file):
self.key = attrid
for b in attr['backends']:
self.backends.add(b)
backend_attr = attr['backends'][b]
if b not in self.backend_attributes:
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']:
self.displayed_attributes[attrid] = attr

Expand Down
Loading