mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Make the --all option work in Add/Remove Member commands.
This commit is contained in:
parent
8c46e09735
commit
aa2c124e7d
@ -511,11 +511,19 @@ class LDAPAddMember(LDAPModMember):
|
|||||||
else:
|
else:
|
||||||
completed += 1
|
completed += 1
|
||||||
|
|
||||||
(dn, entry_attrs) = ldap.get_entry(dn, member_dns.keys()+self.obj.default_attributes)
|
if options.get('all', False):
|
||||||
|
attrs_list = ['*']
|
||||||
|
else:
|
||||||
|
attrs_list = list(
|
||||||
|
set(self.obj.default_attributes + member_dns.keys())
|
||||||
|
)
|
||||||
|
|
||||||
|
(dn, entry_attrs) = ldap.get_entry(dn, attrs_list)
|
||||||
|
|
||||||
(completed, dn) = self.post_callback(
|
(completed, dn) = self.post_callback(
|
||||||
ldap, completed, failed, dn, entry_attrs, *keys, **options
|
ldap, completed, failed, dn, entry_attrs, *keys, **options
|
||||||
)
|
)
|
||||||
|
entry_attrs['dn'] = dn
|
||||||
|
|
||||||
self.obj.convert_attribute_members(entry_attrs, *keys, **options)
|
self.obj.convert_attribute_members(entry_attrs, *keys, **options)
|
||||||
return dict(
|
return dict(
|
||||||
@ -575,11 +583,19 @@ class LDAPRemoveMember(LDAPModMember):
|
|||||||
else:
|
else:
|
||||||
completed += 1
|
completed += 1
|
||||||
|
|
||||||
(dn, entry_attrs) = ldap.get_entry(dn, member_dns.keys())
|
if options.get('all', False):
|
||||||
|
attrs_list = ['*']
|
||||||
|
else:
|
||||||
|
attrs_list = list(
|
||||||
|
set(self.obj.default_attributes + member_dns.keys())
|
||||||
|
)
|
||||||
|
|
||||||
|
(dn, entry_attrs) = ldap.get_entry(dn, attrs_list)
|
||||||
|
|
||||||
(completed, dn) = self.post_callback(
|
(completed, dn) = self.post_callback(
|
||||||
ldap, completed, failed, dn, entry_attrs, *keys, **options
|
ldap, completed, failed, dn, entry_attrs, *keys, **options
|
||||||
)
|
)
|
||||||
|
entry_attrs['dn'] = dn
|
||||||
|
|
||||||
self.obj.convert_attribute_members(entry_attrs, *keys, **options)
|
self.obj.convert_attribute_members(entry_attrs, *keys, **options)
|
||||||
return dict(
|
return dict(
|
||||||
|
@ -362,7 +362,9 @@ class test_group(Declarative):
|
|||||||
user=tuple(),
|
user=tuple(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
result={'member_group': (group2,),
|
result={
|
||||||
|
'dn': u'cn=%s,cn=groups,cn=accounts,%s' % (group1, api.env.basedn),
|
||||||
|
'member_group': (group2,),
|
||||||
'gidnumber': [fuzzy_digits],
|
'gidnumber': [fuzzy_digits],
|
||||||
'cn': [group1],
|
'cn': [group1],
|
||||||
'description': [u'New desc 1'],
|
'description': [u'New desc 1'],
|
||||||
@ -384,7 +386,9 @@ class test_group(Declarative):
|
|||||||
user=tuple(),
|
user=tuple(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
result={'member_group': (group2,),
|
result={
|
||||||
|
'dn': u'cn=%s,cn=groups,cn=accounts,%s' % (group1, api.env.basedn),
|
||||||
|
'member_group': (group2,),
|
||||||
'gidnumber': [fuzzy_digits],
|
'gidnumber': [fuzzy_digits],
|
||||||
'cn': [group1],
|
'cn': [group1],
|
||||||
'description': [u'New desc 1'],
|
'description': [u'New desc 1'],
|
||||||
@ -399,13 +403,18 @@ class test_group(Declarative):
|
|||||||
),
|
),
|
||||||
expected=dict(
|
expected=dict(
|
||||||
completed=1,
|
completed=1,
|
||||||
result=dict(),
|
|
||||||
failed=dict(
|
failed=dict(
|
||||||
member=dict(
|
member=dict(
|
||||||
group=tuple(),
|
group=tuple(),
|
||||||
user=tuple(),
|
user=tuple(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
result={
|
||||||
|
'dn': u'cn=%s,cn=groups,cn=accounts,%s' % (group1, api.env.basedn),
|
||||||
|
'cn': [group1],
|
||||||
|
'gidnumber': [fuzzy_digits],
|
||||||
|
'description': [u'New desc 1'],
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@ -417,13 +426,18 @@ class test_group(Declarative):
|
|||||||
),
|
),
|
||||||
expected=dict(
|
expected=dict(
|
||||||
completed=0,
|
completed=0,
|
||||||
result=dict(),
|
|
||||||
failed=dict(
|
failed=dict(
|
||||||
member=dict(
|
member=dict(
|
||||||
group=(u'notfound',),
|
group=(u'notfound',),
|
||||||
user=tuple(),
|
user=tuple(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
result={
|
||||||
|
'dn': u'cn=%s,cn=groups,cn=accounts,%s' % (group1, api.env.basedn),
|
||||||
|
'cn': [group1],
|
||||||
|
'gidnumber': [fuzzy_digits],
|
||||||
|
'description': [u'New desc 1'],
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -131,6 +131,7 @@ class test_hostgroup(Declarative):
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
result={
|
result={
|
||||||
|
'dn': dn1,
|
||||||
'cn': [hostgroup1],
|
'cn': [hostgroup1],
|
||||||
'description': [u'Test hostgroup 1'],
|
'description': [u'Test hostgroup 1'],
|
||||||
'member_host': [fqdn1],
|
'member_host': [fqdn1],
|
||||||
@ -220,7 +221,11 @@ class test_hostgroup(Declarative):
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
completed=1,
|
completed=1,
|
||||||
result={},
|
result={
|
||||||
|
'dn': dn1,
|
||||||
|
'cn': [hostgroup1],
|
||||||
|
'description': [u'Updated hostgroup 1'],
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -150,6 +150,7 @@ class test_rolegroup(Declarative):
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
result={
|
result={
|
||||||
|
'dn': rolegroup1_dn,
|
||||||
'cn': [rolegroup1],
|
'cn': [rolegroup1],
|
||||||
'description': [u'rolegroup desc 1'],
|
'description': [u'rolegroup desc 1'],
|
||||||
'member_group': [group1],
|
'member_group': [group1],
|
||||||
@ -319,7 +320,11 @@ class test_rolegroup(Declarative):
|
|||||||
hostgroup=[],
|
hostgroup=[],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
result={},
|
result={
|
||||||
|
'dn': rolegroup1_dn,
|
||||||
|
'cn': [rolegroup1],
|
||||||
|
'description': [u'New desc 1'],
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -170,6 +170,7 @@ class test_taskgroup(Declarative):
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
result={
|
result={
|
||||||
|
'dn': taskgroup1_dn,
|
||||||
'cn': [taskgroup1],
|
'cn': [taskgroup1],
|
||||||
'description': [u'Test desc 1'],
|
'description': [u'Test desc 1'],
|
||||||
'member_rolegroup': [rolegroup1],
|
'member_rolegroup': [rolegroup1],
|
||||||
@ -350,6 +351,9 @@ class test_taskgroup(Declarative):
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
result={
|
result={
|
||||||
|
'dn': taskgroup1_dn,
|
||||||
|
'cn': [taskgroup1],
|
||||||
|
'description': [u'New desc 1'],
|
||||||
'member_rolegroup': [rolegroup1],
|
'member_rolegroup': [rolegroup1],
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user