diff options
author | Adam Young <ayoung@redhat.com> | 2010-09-14 16:50:00 -0400 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2010-09-15 15:04:42 -0400 |
commit | 5fd09b016b228c949963c77643f423360a4ada10 (patch) | |
tree | 90c2bca75329d723c7af315aa26b99387d999555 | |
parent | 30def30eaffd9276a5ef226289097020271c7038 (diff) | |
download | freeipa-5fd09b016b228c949963c77643f423360a4ada10.tar.gz freeipa-5fd09b016b228c949963c77643f423360a4ada10.tar.xz freeipa-5fd09b016b228c949963c77643f423360a4ada10.zip |
user-find whoami
Now no longer breaks user-find with a filter
Uses the corrected Params for getting option
printf style strings
-rw-r--r-- | ipalib/plugins/user.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py index 5841d7a01..1cd28c9d8 100644 --- a/ipalib/plugins/user.py +++ b/ipalib/plugins/user.py @@ -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 ) |