mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
User life cycle: user-find support finding delete users
change user plugin commands : user-find user-find support of --preserved option to show preserved (aka deleted) users https://fedorahosted.org/freeipa/ticket/3813 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
committed by
Martin Kosek
parent
4ef32967f7
commit
2744326147
3
API.txt
3
API.txt
@@ -4563,7 +4563,7 @@ output: Output('result', <type 'bool'>, None)
|
||||
output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
|
||||
output: PrimaryKey('value', None, None)
|
||||
command: user_find
|
||||
args: 1,54,4
|
||||
args: 1,55,4
|
||||
arg: Str('criteria?', noextrawhitespace=False)
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
|
||||
option: Str('carlicense', attribute=True, autofill=False, cli_name='carlicense', multivalue=True, query=True, required=False)
|
||||
@@ -4605,6 +4605,7 @@ option: Str('pager', attribute=True, autofill=False, cli_name='pager', multivalu
|
||||
option: Flag('pkey_only?', autofill=True, default=False)
|
||||
option: Str('postalcode', attribute=True, autofill=False, cli_name='postalcode', multivalue=False, query=True, required=False)
|
||||
option: Str('preferredlanguage', attribute=True, autofill=False, cli_name='preferredlanguage', multivalue=False, pattern='^(([a-zA-Z]{1,8}(-[a-zA-Z]{1,8})?(;q\\=((0(\\.[0-9]{0,3})?)|(1(\\.0{0,3})?)))?(\\s*,\\s*[a-zA-Z]{1,8}(-[a-zA-Z]{1,8})?(;q\\=((0(\\.[0-9]{0,3})?)|(1(\\.0{0,3})?)))?)*)|(\\*))$', query=True, required=False)
|
||||
option: Flag('preserved?', autofill=True, cli_name='preserved', default=False)
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
|
||||
option: Int('sizelimit?', autofill=False, minvalue=0)
|
||||
option: Str('sn', attribute=True, autofill=False, cli_name='last', multivalue=False, query=True, required=False)
|
||||
|
||||
@@ -387,7 +387,6 @@ class user_add(baseuser_add):
|
||||
|
||||
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
|
||||
assert isinstance(dn, DN)
|
||||
self.log.error("====> user-add pre_callback 1 %s " % dn)
|
||||
if not options.get('noprivate', False):
|
||||
try:
|
||||
# The Managed Entries plugin will allow a user to be created
|
||||
@@ -494,7 +493,6 @@ class user_add(baseuser_add):
|
||||
|
||||
answer = self.api.Object['radiusproxy'].get_dn_if_exists(rcl)
|
||||
entry_attrs['ipatokenradiusconfiglink'] = answer
|
||||
self.log.error("====> user-add pre_callback %s " % dn)
|
||||
|
||||
return dn
|
||||
|
||||
@@ -682,14 +680,32 @@ class user_find(baseuser_find):
|
||||
label=_('Self'),
|
||||
doc=_('Display user record for current Kerberos principal'),
|
||||
),
|
||||
Flag('preserved?',
|
||||
doc=_('Display preserved deleted user'),
|
||||
cli_name='preserved',
|
||||
default=False,
|
||||
),
|
||||
)
|
||||
|
||||
def execute(self, *args, **options):
|
||||
if self.original_msg_summary:
|
||||
object.__setattr__(self, 'msg_summary', self.original_msg_summary)
|
||||
newoptions = {}
|
||||
self.common_enhance_options(newoptions, **options)
|
||||
options.update(newoptions)
|
||||
|
||||
return super(user_find, self).execute(self, *args, **options)
|
||||
for arg in args:
|
||||
self.log.debug("user-find- exec arg %r" % (arg))
|
||||
if options['preserved']:
|
||||
self.obj.container_dn = baseuser.delete_container_dn
|
||||
self.msg_summary = ngettext('%(count)d (delete) user matched', '%(count)d (delete) users matched', 0)
|
||||
|
||||
ret = super(user_find, self).execute(self, *args, **options)
|
||||
|
||||
self.obj.container_dn = baseuser.active_container_dn
|
||||
return ret
|
||||
else:
|
||||
return super(user_find, self).execute(self, *args, **options)
|
||||
|
||||
def pre_callback(self, ldap, filter, attrs_list, base_dn, scope, *keys, **options):
|
||||
assert isinstance(base_dn, DN)
|
||||
@@ -708,6 +724,7 @@ class user_find(baseuser_find):
|
||||
msg_summary = ngettext(
|
||||
'%(count)d user matched', '%(count)d users matched', 0
|
||||
)
|
||||
original_msg_summary = msg_summary
|
||||
|
||||
|
||||
@register()
|
||||
|
||||
Reference in New Issue
Block a user