]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Starting with bin/remove-ldap-user and its application module pp_admintools.apps...
authorFrank Brehm <frank.brehm@pixelpark.com>
Mon, 5 Sep 2022 14:39:42 +0000 (16:39 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Mon, 5 Sep 2022 14:39:42 +0000 (16:39 +0200)
bin/remove-ldap-user [new file with mode: 0755]
lib/pp_admintools/apps/__init__.py [new file with mode: 0644]
lib/pp_admintools/apps/remove_ldap_user.py [new file with mode: 0644]

diff --git a/bin/remove-ldap-user b/bin/remove-ldap-user
new file mode 100755 (executable)
index 0000000..47ab83f
--- /dev/null
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+
+from __future__ import print_function
+
+# Standard modules
+import sys
+
+__exp_py_version_major__ = 3
+__min_py_version_minor__ = 6
+
+if sys.version_info[0] != __exp_py_version_major__:
+    print("This script is intended to use with Python {}.".format(
+        __exp_py_version_major__), file=sys.stderr)
+    print("You are using Python: {0}.{1}.{2}-{3}-{4}.".format(
+        *sys.version_info) + "\n", file=sys.stderr)
+    sys.exit(1)
+
+if sys.version_info[1] < __min_py_version_minor__:
+    print("A minimal Python version of {maj}.{min} is necessary to execute this script.".format(
+        maj=__exp_py_version_major__, min=__min_py_version_minor__), file=sys.stderr)
+    print("You are using Python: {0}.{1}.{2}-{3}-{4}.".format(
+        *sys.version_info) + "\n", file=sys.stderr)
+    sys.exit(1)
+
+# Standard modules
+import os
+import locale
+
+try:
+    from pathlib import Path
+except ImportError:
+    from pathlib2 import Path
+
+__author__ = 'Frank Brehm <frank.brehm@pixelpark.com>'
+__copyright__ = '(C) 2022 by Frank Brehm, Digitas Pixelpark GmbH, Berlin'
+
+# own modules:
+
+my_path = Path(__file__)
+my_real_path = my_path.resolve()
+bin_path = my_real_path.parent
+base_dir = bin_path.parent
+lib_dir = base_dir.joinpath('lib')
+module_dir = lib_dir.joinpath('pp_admintools')
+
+if module_dir.exists():
+    sys.path.insert(0, str(lib_dir))
+
+from pp_admintools.apps.remove_ldap_user import RemoveLdapUserApplication
+
+appname = os.path.basename(sys.argv[0])
+
+locale.setlocale(locale.LC_ALL, '')
+
+app = RemoveLdapUserApplication(appname=appname, base_dir=base_dir)
+app.initialized = True
+
+if app.verbose > 2:
+    print("{c}-Object:\n{a}".format(c=app.__class__.__name__, a=app))
+
+# app()
+
+sys.exit(0)
+
+# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
diff --git a/lib/pp_admintools/apps/__init__.py b/lib/pp_admintools/apps/__init__.py
new file mode 100644 (file)
index 0000000..41823bf
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/env python3
+# -*- coding: utf-8 -*-
+
+__version__ = '0.1.0'
+
+# vim: ts=4 et list
+
diff --git a/lib/pp_admintools/apps/remove_ldap_user.py b/lib/pp_admintools/apps/remove_ldap_user.py
new file mode 100644 (file)
index 0000000..7e22745
--- /dev/null
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+"""
+@author: Frank Brehm
+@contact: frank.brehm@pixelpark.com
+@copyright: © 2022 by Frank Brehm, Berlin
+@summary: An application module for disabling or removing a user from LDAP
+"""
+from __future__ import absolute_import
+
+# Standard modules
+import logging
+
+# Third party modules
+
+# Own modules
+from ..xlate import XLATOR
+
+from ..ldap_app import LdapAppError
+from ..ldap_app import BaseLdapApplication
+
+__version__ = '0.1.0'
+LOG = logging.getLogger(__name__)
+
+_ = XLATOR.gettext
+ngettext = XLATOR.ngettext
+
+
+# =============================================================================
+class RemoveLdapUserError(LdapAppError):
+    """Special exception class for exceptions inside this module."""
+
+    pass
+
+
+# =============================================================================
+class RemoveLdapUserApplication(BaseLdapApplication):
+    """Application class for disabling or removing a user from LDAP."""
+
+    pass
+
+
+# =============================================================================
+if __name__ == "__main__":
+
+    pass
+
+# =============================================================================
+
+# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 list