mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-25 18:54:29 +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:
|
if not u in ret:
|
||||||
ret[u] = {}
|
ret[u] = {}
|
||||||
for attr in tmp[u]:
|
for attr in tmp[u]:
|
||||||
|
if attr in self.attributes.backend_attributes[b]:
|
||||||
|
attrid = self.attributes.backend_attributes[b][attr]
|
||||||
if not attr in ret[u]:
|
if not attr in ret[u]:
|
||||||
ret[u][attr] = tmp[u][attr]
|
ret[u][attrid] = tmp[u][attr]
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def _check_admin(self):
|
def _check_admin(self):
|
||||||
|
@ -48,8 +48,8 @@ class Attributes:
|
|||||||
for b in attr['backends']:
|
for b in attr['backends']:
|
||||||
self.backends.add(b)
|
self.backends.add(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].append(attr['backends'][b])
|
self.backend_attributes[b][attr['backends'][b]] = attrid
|
||||||
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
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class Attributes:
|
|||||||
def get_backend_attributes(self, backend):
|
def get_backend_attributes(self, backend):
|
||||||
if backend not in self.backends:
|
if backend not in self.backends:
|
||||||
raise WrongBackend(backend)
|
raise WrongBackend(backend)
|
||||||
return self.backend_attributes[backend]
|
return self.backend_attributes[backend].keys()
|
||||||
|
|
||||||
def get_backend_key(self, backend):
|
def get_backend_key(self, backend):
|
||||||
if backend not in self.backends:
|
if backend not in self.backends:
|
||||||
|
@ -39,7 +39,7 @@ class TestError(object):
|
|||||||
def testGetBackendAttributes(self):
|
def testGetBackendAttributes(self):
|
||||||
inv = Attributes('./tests/cfg/attributes.yml')
|
inv = Attributes('./tests/cfg/attributes.yml')
|
||||||
ret = inv.get_backend_attributes('ldap')
|
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
|
assert ret == expected
|
||||||
|
|
||||||
def testGetKey(self):
|
def testGetKey(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user