]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Fixing logic gap because of removing or deactivating an user.
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 30 May 2023 13:37:01 +0000 (15:37 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 30 May 2023 13:37:01 +0000 (15:37 +0200)
lib/pp_admintools/app/remove_ldap_user.py

index 87ca98ea06ee49167a0dc51e01ac2ad083ca9a1c..e1a3d93507689d9da99a178b80afb33c87e37434 100644 (file)
@@ -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