mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-27 00:26:33 -06:00
automember: fix automember to work with thin client
Properly mark `cn` as primary key of `automember` object. This fixes automember crashing on output validation expecting primary key value of None. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
parent
055dfaf657
commit
61987b66ba
5
API.txt
5
API.txt
@ -167,17 +167,18 @@ output: Output('summary', type=[<type 'unicode'>, <type 'NoneType'>])
|
||||
output: PrimaryKey('value')
|
||||
command: automember_del
|
||||
args: 1,2,3
|
||||
arg: Str('cn', cli_name='automember_rule')
|
||||
arg: Str('cn+', cli_name='automember_rule')
|
||||
option: StrEnum('type', values=[u'group', u'hostgroup'])
|
||||
option: Str('version?')
|
||||
output: Output('result', type=[<type 'dict'>])
|
||||
output: Output('summary', type=[<type 'unicode'>, <type 'NoneType'>])
|
||||
output: ListOfPrimaryKeys('value')
|
||||
command: automember_find
|
||||
args: 1,5,4
|
||||
args: 1,6,4
|
||||
arg: Str('criteria?')
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False)
|
||||
option: Str('description?', autofill=False, cli_name='desc')
|
||||
option: Flag('pkey_only?', autofill=True, default=False)
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False)
|
||||
option: StrEnum('type', values=[u'group', u'hostgroup'])
|
||||
option: Str('version?')
|
||||
|
4
VERSION
4
VERSION
@ -90,5 +90,5 @@ IPA_DATA_VERSION=20100614120000
|
||||
# #
|
||||
########################################################
|
||||
IPA_API_VERSION_MAJOR=2
|
||||
IPA_API_VERSION_MINOR=199
|
||||
# Last change: schema: Add known_fingerprints option to schema command
|
||||
IPA_API_VERSION_MINOR=200
|
||||
# Last change: automember: TODO
|
||||
|
@ -182,16 +182,6 @@ group_type = (
|
||||
),
|
||||
)
|
||||
|
||||
automember_rule = (
|
||||
Str('cn',
|
||||
cli_name='automember_rule',
|
||||
label=_('Automember Rule'),
|
||||
doc=_('Automember Rule'),
|
||||
normalizer=lambda value: value.lower(),
|
||||
flags={'no_create', 'no_update', 'no_search'},
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@register()
|
||||
class automember(LDAPObject):
|
||||
@ -249,6 +239,14 @@ class automember(LDAPObject):
|
||||
label = _('Auto Membership Rule')
|
||||
|
||||
takes_params = (
|
||||
Str('cn',
|
||||
cli_name='automember_rule',
|
||||
label=_('Automember Rule'),
|
||||
doc=_('Automember Rule'),
|
||||
primary_key=True,
|
||||
normalizer=lambda value: value.lower(),
|
||||
flags={'no_search'},
|
||||
),
|
||||
Str('description?',
|
||||
cli_name='desc',
|
||||
label=_('Description'),
|
||||
@ -260,7 +258,7 @@ class automember(LDAPObject):
|
||||
doc=_('Default group for entries to land'),
|
||||
flags=['no_create', 'no_update', 'no_search']
|
||||
),
|
||||
) + automember_rule + regex_attrs
|
||||
) + regex_attrs
|
||||
|
||||
def dn_exists(self, otype, oname):
|
||||
ldap = self.api.Backend.ldap2
|
||||
@ -312,7 +310,6 @@ class automember_add(LDAPCreate):
|
||||
Add an automember rule.
|
||||
""")
|
||||
takes_options = LDAPCreate.takes_options + group_type
|
||||
takes_args = automember_rule
|
||||
msg_summary = _('Added automember rule "%(value)s"')
|
||||
|
||||
def pre_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
||||
@ -343,7 +340,6 @@ class automember_add_condition(LDAPUpdate):
|
||||
)
|
||||
|
||||
takes_options = regex_attrs + regex_key + group_type
|
||||
takes_args = automember_rule
|
||||
msg_summary = _('Added condition(s) to "%(value)s"')
|
||||
|
||||
# Prepare the output to expect failed results
|
||||
@ -428,7 +424,6 @@ class automember_remove_condition(LDAPUpdate):
|
||||
Remove conditions from an automember rule.
|
||||
""")
|
||||
takes_options = regex_attrs + regex_key + group_type
|
||||
takes_args = automember_rule
|
||||
msg_summary = _('Removed condition(s) from "%(value)s"')
|
||||
|
||||
# Prepare the output to expect failed results
|
||||
@ -514,7 +509,6 @@ class automember_mod(LDAPUpdate):
|
||||
__doc__ = _("""
|
||||
Modify an automember rule.
|
||||
""")
|
||||
takes_args = automember_rule
|
||||
takes_options = LDAPUpdate.takes_options + group_type
|
||||
msg_summary = _('Modified automember rule "%(value)s"')
|
||||
|
||||
@ -529,15 +523,9 @@ class automember_del(LDAPDelete):
|
||||
__doc__ = _("""
|
||||
Delete an automember rule.
|
||||
""")
|
||||
takes_args = automember_rule
|
||||
takes_options = group_type
|
||||
msg_summary = _('Deleted automember rule "%(value)s"')
|
||||
|
||||
def execute(self, *keys, **options):
|
||||
result = super(automember_del, self).execute(*keys, **options)
|
||||
result['value'] = pkey_to_value([keys[-1]], options)
|
||||
return result
|
||||
|
||||
|
||||
@register()
|
||||
class automember_find(LDAPSearch):
|
||||
@ -562,7 +550,6 @@ class automember_show(LDAPRetrieve):
|
||||
__doc__ = _("""
|
||||
Display information about an automember rule.
|
||||
""")
|
||||
takes_args = automember_rule
|
||||
takes_options = group_type
|
||||
|
||||
def execute(self, *keys, **options):
|
||||
@ -571,12 +558,25 @@ class automember_show(LDAPRetrieve):
|
||||
return result
|
||||
|
||||
|
||||
@register()
|
||||
class automember_default_group(automember):
|
||||
managed_permissions = {}
|
||||
|
||||
def get_params(self):
|
||||
for param in super(automember_default_group, self).get_params():
|
||||
if param.name == 'cn':
|
||||
continue
|
||||
yield param
|
||||
|
||||
|
||||
@register()
|
||||
class automember_default_group_set(LDAPUpdate):
|
||||
__doc__ = _("""
|
||||
Set default (fallback) group for all unmatched entries.
|
||||
""")
|
||||
|
||||
obj_name = 'automember_default_group'
|
||||
|
||||
takes_options = (
|
||||
Str('automemberdefaultgroup',
|
||||
cli_name='default_group',
|
||||
@ -605,6 +605,8 @@ class automember_default_group_remove(LDAPUpdate):
|
||||
Remove default (fallback) group for all unmatched entries.
|
||||
""")
|
||||
|
||||
obj_name = 'automember_default_group'
|
||||
|
||||
takes_options = group_type
|
||||
msg_summary = _('Removed default (fallback) group for automember "%(value)s"')
|
||||
|
||||
@ -638,6 +640,9 @@ class automember_default_group_show(LDAPRetrieve):
|
||||
__doc__ = _("""
|
||||
Display information about the default (fallback) automember groups.
|
||||
""")
|
||||
|
||||
obj_name = 'automember_default_group'
|
||||
|
||||
takes_options = group_type
|
||||
|
||||
def pre_callback(self, ldap, dn, attrs_list, *keys, **options):
|
||||
|
Loading…
Reference in New Issue
Block a user