From ffc3921f80f58cfca8c82a44750fe43d819d4be6 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 30 May 2023 15:37:01 +0200 Subject: [PATCH] Fixing logic gap because of removing or deactivating an user. --- lib/pp_admintools/app/remove_ldap_user.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/pp_admintools/app/remove_ldap_user.py b/lib/pp_admintools/app/remove_ldap_user.py index 87ca98e..e1a3d93 100644 --- a/lib/pp_admintools/app/remove_ldap_user.py +++ b/lib/pp_admintools/app/remove_ldap_user.py @@ -25,7 +25,7 @@ from ..xlate import XLATOR from .ldap import LdapAppError, FatalLDAPError from .ldap import BaseLdapApplication -__version__ = '0.5.8' +__version__ = '0.5.9' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -130,7 +130,7 @@ class RemoveLdapUserApplication(BaseLdapApplication): if not self.deactivate: help_txt += help_default remove_mode_group.add_argument( - '-R', '--remove', dest="deactivate", action='store_false', help=help_txt) + '-R', '--remove', dest="remove", action='store_true', help=help_txt) remove_group.add_argument( 'users', nargs='*', metavar=_('USER'), @@ -161,7 +161,10 @@ class RemoveLdapUserApplication(BaseLdapApplication): LOG.error(_("No users to remove given.")) self.exit(1) - self.deactivate = getattr(self.args, 'deactivate', False) + deactivate = bool(getattr(self.args, 'remove', False)) + remove = bool(getattr(self.args, 'remove', False)) + if remove: + self.deactivate = False self.given_users = given_users -- 2.39.5