mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
Fix delegation-find command --group handling
A wrong way of handling --group DN object caused Internal Error for this command. Fix that and also provide unit tests to avoid another regression. https://fedorahosted.org/freeipa/ticket/3311
This commit is contained in:
parent
e8cb869046
commit
86e56b9125
@ -801,7 +801,7 @@ class aci_find(crud.Search):
|
||||
groupdn = a.bindrule['expression']
|
||||
groupdn = DN(groupdn.replace('ldap:///',''))
|
||||
try:
|
||||
cn = groupdn[0]['cn'].value
|
||||
cn = groupdn[0]['cn']
|
||||
except (IndexError, KeyError):
|
||||
cn = None
|
||||
if cn is None or cn != kw['group']:
|
||||
|
@ -177,6 +177,46 @@ class test_delegation(Declarative):
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Search for %r using --group filter' % delegation1,
|
||||
command=('delegation_find', [delegation1], {'group': u'editors'}),
|
||||
expected=dict(
|
||||
count=1,
|
||||
truncated=False,
|
||||
summary=u'1 delegation matched',
|
||||
result=[
|
||||
{
|
||||
'attrs': [u'street', u'c', u'l', u'st', u'postalcode'],
|
||||
'permissions': [u'write'],
|
||||
'aciname': delegation1,
|
||||
'group': u'editors',
|
||||
'memberof': member1,
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Search for %r using --membergroup filter' % delegation1,
|
||||
command=('delegation_find', [delegation1], {'memberof': member1}),
|
||||
expected=dict(
|
||||
count=1,
|
||||
truncated=False,
|
||||
summary=u'1 delegation matched',
|
||||
result=[
|
||||
{
|
||||
'attrs': [u'street', u'c', u'l', u'st', u'postalcode'],
|
||||
'permissions': [u'write'],
|
||||
'aciname': delegation1,
|
||||
'group': u'editors',
|
||||
'memberof': member1,
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Search for %r with --pkey-only' % delegation1,
|
||||
command=('delegation_find', [delegation1], {'pkey_only' : True}),
|
||||
|
Loading…
Reference in New Issue
Block a user