URL: https://github.com/freeipa/freeipa/pull/444
Author: redhatrises
 Title: #444: Allow nsaccountlock to be searched in user-find and user-show 
commands
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/444/head:pr444
git checkout pr444
From 7d05370406628ddc6dfaffeb81b8df31b72ea255 Mon Sep 17 00:00:00 2001
From: Gabe <redhatri...@gmail.com>
Date: Wed, 8 Feb 2017 08:30:02 -0700
Subject: [PATCH] Allow nsaccountlock to be searched in user-find and user-show
 commands

This patch provides the ability to search and find users who are
enabled/disabled in `ipa user-show` and `ipa user-find` commands without
break API compatibility.
---
 ipaserver/plugins/user.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/ipaserver/plugins/user.py b/ipaserver/plugins/user.py
index 1ef71d2..0194f1b 100644
--- a/ipaserver/plugins/user.py
+++ b/ipaserver/plugins/user.py
@@ -780,6 +780,14 @@ class user_find(baseuser_find):
         ),
     )
 
+    def get_options(self):
+        for option in super(user_find, self).get_options():
+            if option.name == 'nsaccountlock':
+                flags = set(option.flags)
+                flags.remove('no_option')
+                option = option.clone(flags=flags)
+            yield option
+
     def pre_callback(self, ldap, filter, attrs_list, base_dn, scope, *keys, **options):
         assert isinstance(base_dn, DN)
         self.pre_common_callback(ldap, filter, attrs_list, base_dn, scope,
@@ -830,6 +838,14 @@ class user_show(baseuser_show):
         ),
     )
 
+    def get_options(self):
+        for option in super(user_show, self).get_options():
+            if option.name == 'nsaccountlock':
+                flags = set(option.flags)
+                flags.remove('no_option')
+                option = option.clone(flags=flags)
+            yield option
+
     def pre_callback(self, ldap, dn, attrs_list, *keys, **options):
         dn = self.obj.get_either_dn(*keys, **options)
         self.pre_common_callback(ldap, dn, attrs_list, *keys, **options)
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to