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: opened

PR body:
"""
This patch provides the ability to search and find users who are 
enabled/disabled in `ipa user-show` and `ipa user-find` commands without 
breaking API compatibility.
"""

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 18e84015160f911049aa9451651bcf2a8c167204 Mon Sep 17 00:00:00 2001
From: Gabe <redhatri...@gmail.com>
Date: Wed, 8 Feb 2017 08:06:00 -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..f7ac3ef 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 options.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 options.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