mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-28 09:06:44 -06:00
user-find whoami
Now no longer breaks user-find with a filter Uses the corrected Params for getting option printf style strings
This commit is contained in:
parent
30def30eaf
commit
5fd09b016b
@ -51,6 +51,7 @@ from ipalib import api, errors
|
||||
from ipalib import Flag, Int, Password, Str
|
||||
from ipalib.plugins.baseldap import *
|
||||
from ipalib import _, ngettext
|
||||
from ipalib import util
|
||||
|
||||
|
||||
class user(LDAPObject):
|
||||
@ -241,6 +242,18 @@ class user_find(LDAPSearch):
|
||||
Search for users.
|
||||
"""
|
||||
|
||||
takes_options = (
|
||||
Flag('whoami',
|
||||
label=_('Self'),
|
||||
doc=_('Display user record for current Kerberos principal'),
|
||||
),
|
||||
)
|
||||
def pre_callback(self, ldap, filter, entry_attrs, attrs_list, *keys, **options):
|
||||
if options.get('whoami'):
|
||||
return "(&(objectclass=posixaccount)(krbprincipalname=%s))"%\
|
||||
util.get_current_principal()
|
||||
return filter
|
||||
|
||||
msg_summary = ngettext(
|
||||
'%(count)d user matched', '%(count)d users matched', 0
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user