mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 01:14:21 +01:00
fix search display
* fix attritues handling, not using backend attribute name but key given in attributes.yml
This commit is contained in:
parent
47e51d2451
commit
322aba33e8
@ -332,8 +332,10 @@ class LdapCherry(object):
|
||||
if not u in ret:
|
||||
ret[u] = {}
|
||||
for attr in tmp[u]:
|
||||
if not attr in ret[u]:
|
||||
ret[u][attr] = tmp[u][attr]
|
||||
if attr in self.attributes.backend_attributes[b]:
|
||||
attrid = self.attributes.backend_attributes[b][attr]
|
||||
if not attr in ret[u]:
|
||||
ret[u][attrid] = tmp[u][attr]
|
||||
return ret
|
||||
|
||||
def _check_admin(self):
|
||||
|
@ -48,8 +48,8 @@ class Attributes:
|
||||
for b in attr['backends']:
|
||||
self.backends.add(b)
|
||||
if b not in self.backend_attributes:
|
||||
self.backend_attributes[b] = []
|
||||
self.backend_attributes[b].append(attr['backends'][b])
|
||||
self.backend_attributes[b] = {}
|
||||
self.backend_attributes[b][attr['backends'][b]] = attrid
|
||||
if 'search_displayed' in attr and attr['search_displayed']:
|
||||
self.displayed_attributes[attrid] = attr
|
||||
|
||||
@ -78,7 +78,7 @@ class Attributes:
|
||||
def get_backend_attributes(self, backend):
|
||||
if backend not in self.backends:
|
||||
raise WrongBackend(backend)
|
||||
return self.backend_attributes[backend]
|
||||
return self.backend_attributes[backend].keys()
|
||||
|
||||
def get_backend_key(self, backend):
|
||||
if backend not in self.backends:
|
||||
|
@ -39,7 +39,7 @@ class TestError(object):
|
||||
def testGetBackendAttributes(self):
|
||||
inv = Attributes('./tests/cfg/attributes.yml')
|
||||
ret = inv.get_backend_attributes('ldap')
|
||||
expected = ['shell', 'cn', 'uid', 'uidNumber', 'gidNumber', 'home', 'userPassword', 'givenName', 'email', 'sn']
|
||||
expected = ['shell', 'cn', 'userPassword', 'uidNumber', 'gidNumber', 'sn', 'home', 'givenName', 'email', 'uid']
|
||||
assert ret == expected
|
||||
|
||||
def testGetKey(self):
|
||||
|
Loading…
Reference in New Issue
Block a user