mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
Sort entries returned by *-find by the primary key (if any).
Do a server-side sort if there is a primary key. Fix a couple of tests that were failing due to the new sorting. ticket 794
This commit is contained in:
parent
1ac3ed2c27
commit
9cac1d88fc
@ -1418,6 +1418,10 @@ class LDAPSearch(CallbackInterface, crud.Search):
|
|||||||
else:
|
else:
|
||||||
callback(self, ldap, entries, truncated, *args, **options)
|
callback(self, ldap, entries, truncated, *args, **options)
|
||||||
|
|
||||||
|
if self.obj.primary_key:
|
||||||
|
sortfn=lambda x,y: cmp(x[1][self.obj.primary_key.name][0].lower(), y[1][self.obj.primary_key.name][0].lower())
|
||||||
|
entries.sort(sortfn)
|
||||||
|
|
||||||
if not options.get('raw', False):
|
if not options.get('raw', False):
|
||||||
for e in entries:
|
for e in entries:
|
||||||
self.obj.convert_attribute_members(e[1], *args, **options)
|
self.obj.convert_attribute_members(e[1], *args, **options)
|
||||||
|
@ -119,8 +119,8 @@ class test_automount(XMLRPC_test):
|
|||||||
res = api.Command['automountkey_find'](self.locname, self.mapname, raw=True)['result']
|
res = api.Command['automountkey_find'](self.locname, self.mapname, raw=True)['result']
|
||||||
assert res
|
assert res
|
||||||
assert len(res) == 2
|
assert len(res) == 2
|
||||||
assert_attr_equal(res[1], 'automountkey', self.keyname)
|
assert_attr_equal(res[0], 'automountkey', self.keyname)
|
||||||
assert_attr_equal(res[1], 'automountinformation', self.info)
|
assert_attr_equal(res[0], 'automountinformation', self.info)
|
||||||
|
|
||||||
def test_9_automountkey_mod(self):
|
def test_9_automountkey_mod(self):
|
||||||
"""
|
"""
|
||||||
|
@ -335,18 +335,18 @@ class test_group(Declarative):
|
|||||||
'cn': [u'admins'],
|
'cn': [u'admins'],
|
||||||
'description': [u'Account administrators group'],
|
'description': [u'Account administrators group'],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'dn': u'cn=ipausers,cn=groups,cn=accounts,%s' % api.env.basedn,
|
|
||||||
'gidnumber': [fuzzy_digits],
|
|
||||||
'cn': [u'ipausers'],
|
|
||||||
'description': [u'Default group for all users'],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'dn': u'cn=editors,cn=groups,cn=accounts,%s' % api.env.basedn,
|
'dn': u'cn=editors,cn=groups,cn=accounts,%s' % api.env.basedn,
|
||||||
'gidnumber': [fuzzy_digits],
|
'gidnumber': [fuzzy_digits],
|
||||||
'cn': [u'editors'],
|
'cn': [u'editors'],
|
||||||
'description': [u'Limited admins who can edit other users'],
|
'description': [u'Limited admins who can edit other users'],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'dn': u'cn=ipausers,cn=groups,cn=accounts,%s' % api.env.basedn,
|
||||||
|
'gidnumber': [fuzzy_digits],
|
||||||
|
'cn': [u'ipausers'],
|
||||||
|
'description': [u'Default group for all users'],
|
||||||
|
},
|
||||||
dict(
|
dict(
|
||||||
dn=u'cn=%s,cn=groups,cn=accounts,%s' % (group1, api.env.basedn),
|
dn=u'cn=%s,cn=groups,cn=accounts,%s' % (group1, api.env.basedn),
|
||||||
cn=[group1],
|
cn=[group1],
|
||||||
|
Loading…
Reference in New Issue
Block a user