Skip to content

Commit

Permalink
Allow nsaccountlock to be searched in user-find command
Browse files Browse the repository at this point in the history
This patch provides the ability to search and find users who are
enabled/disabled in `ipa user-find` command without breaking API compatibility.
  • Loading branch information
redhatrises committed Feb 12, 2017
1 parent 387a151 commit f3d33fb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
6 changes: 3 additions & 3 deletions API.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5764,7 +5764,7 @@ option: Str('manager?')
option: Str('mobile*')
option: Flag('no_members', autofill=True, default=False)
option: Flag('noprivate', autofill=True, cli_name='noprivate', default=False)
option: Bool('nsaccountlock?')
option: Bool('nsaccountlock?', cli_name='disabled')
option: Str('ou?', cli_name='orgunit')
option: Str('pager*')
option: Str('postalcode?')
Expand Down Expand Up @@ -5878,7 +5878,7 @@ option: Str('not_in_hbacrule*', cli_name='not_in_hbacrules')
option: Str('not_in_netgroup*', cli_name='not_in_netgroups')
option: Str('not_in_role*', cli_name='not_in_roles')
option: Str('not_in_sudorule*', cli_name='not_in_sudorules')
option: Bool('nsaccountlock?', autofill=False)
option: Bool('nsaccountlock?', autofill=False, cli_name='disabled')
option: Str('ou?', autofill=False, cli_name='orgunit')
option: Str('pager*', autofill=False)
option: Flag('pkey_only?', autofill=True, default=False)
Expand Down Expand Up @@ -5934,7 +5934,7 @@ option: Str('mail*', autofill=False, cli_name='email')
option: Str('manager?', autofill=False)
option: Str('mobile*', autofill=False)
option: Flag('no_members', autofill=True, default=False)
option: Bool('nsaccountlock?', autofill=False)
option: Bool('nsaccountlock?', autofill=False, cli_name='disabled')
option: Str('ou?', autofill=False, cli_name='orgunit')
option: Str('pager*', autofill=False)
option: Str('postalcode?', autofill=False)
Expand Down
4 changes: 2 additions & 2 deletions VERSION.m4
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ define(IPA_DATA_VERSION, 20100614120000)
# #
########################################################
define(IPA_API_VERSION_MAJOR, 2)
define(IPA_API_VERSION_MINOR, 217)
# Last change: Add options to write lightweight CA cert or chain to file
define(IPA_API_VERSION_MINOR, 218)
# Last change: Remove no_option flag for nsaccountlock and add cli_name='disabled'


########################################################
Expand Down
18 changes: 17 additions & 1 deletion ipaserver/plugins/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ class user(baseuser):

takes_params = baseuser.takes_params + (
Bool('nsaccountlock?',
cli_name=('disabled'),
label=_('Account disabled'),
flags=['no_option'],
),
Bool('preserved?',
label=_('Preserved user'),
Expand Down Expand Up @@ -443,6 +443,14 @@ class user_add(baseuser_add):
),
)

def get_options(self):
for option in super(user_add, self).get_options():
if option.name == "nsaccountlock":
flags = set(option.flags)
flags.add("no_option")
option = option.clone(flags=flags)
yield option

def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
delete_dn = self.obj.get_delete_dn(*keys, **options)
try:
Expand Down Expand Up @@ -749,6 +757,14 @@ class user_mod(baseuser_mod):

has_output_params = baseuser_mod.has_output_params + user_output_params

def get_options(self):
for option in super(user_mod, self).get_options():
if option.name == "nsaccountlock":
flags = set(option.flags)
flags.add("no_option")
option = option.clone(flags=flags)
yield option

def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
dn = self.obj.get_either_dn(*keys, **options)
self.pre_common_callback(ldap, dn, entry_attrs, attrs_list, *keys,
Expand Down

0 comments on commit f3d33fb

Please sign in to comment.