mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 23:50:03 -06:00
permission-find no longer crashes with --targetgroup
Target Group parameter was not processed correctly which caused permission-find to always crash when this search parameter was used. Fix the crash and create a unit test case to avoid future regression. https://fedorahosted.org/freeipa/ticket/3335
This commit is contained in:
parent
746181a88d
commit
cb7e93bb91
@ -815,8 +815,9 @@ class aci_find(crud.Search):
|
||||
found = False
|
||||
if 'target' in a.target:
|
||||
target = a.target['target']['expression']
|
||||
if api.env.container_group in target:
|
||||
targetdn = DN(target.replace('ldap:///',''))
|
||||
targetdn = DN(target.replace('ldap:///',''))
|
||||
group_container_dn = DN(api.env.container_group, api.env.basedn)
|
||||
if targetdn.endswith(group_container_dn):
|
||||
try:
|
||||
cn = targetdn[0]['cn']
|
||||
except (IndexError, KeyError):
|
||||
|
@ -697,6 +697,29 @@ class test_permission(Declarative):
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Search using --targetgroup',
|
||||
command=('permission_find', [], {'targetgroup': u'ipausers'}),
|
||||
expected=dict(
|
||||
count=1,
|
||||
truncated=False,
|
||||
summary=u'1 permission matched',
|
||||
result=[
|
||||
{
|
||||
'dn': DN(('cn','Add user to default group'),
|
||||
api.env.container_permission, api.env.basedn),
|
||||
'cn': [u'Add user to default group'],
|
||||
'member_privilege': [u'User Administrators'],
|
||||
'attrs': [u'member'],
|
||||
'targetgroup': u'ipausers',
|
||||
'memberindirect_role': [u'User Administrator'],
|
||||
'permissions': [u'write']
|
||||
}
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Delete %r' % permission1_renamed_ucase,
|
||||
command=('permission_del', [permission1_renamed_ucase], {}),
|
||||
|
Loading…
Reference in New Issue
Block a user