admiyo-freeipa-0024-user-whoami.patch broke the user-find, due to a missing return statement. It has been reverted. Here is the corrected one.

>From 2e7716bf1dc45338cd964c42dba43983948bb97e Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Tue, 14 Sep 2010 16:50:00 -0400
Subject: [PATCH] user-find whoami

Now no longer breaks user-find with a filter
---
 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 5841d7a..c64851b 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', True):
+            return "(&(objectclass=posixaccount)(krbprincipalname="+\
+                util.get_current_principal() + "))"
+        return filter
+
     msg_summary = ngettext(
         '%(count)d user matched', '%(count)d users matched', 0
     )
-- 
1.7.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to