Skip to content

wonitatts/Auto_Delete_Profile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auto Delete Profile

Python Platform License

Employee Offboarding Automation Framework

Auto Delete Profile is a Python-based automation tool designed to streamline the employee offboarding process for vendor organizations. This framework provides a centralized, extensible solution for managing employee profile deletions across multiple vendor systems through an intuitive graphical interface.


Overview

Auto Delete Profile eliminates manual, error-prone offboarding processes by automating employee profile deletion workflows. The tool supports multiple vendor integrations through a modular architecture, allowing organizations to maintain a single interface for managing offboarding tasks across different vendor platforms.

The application features a user-friendly Tkinter GUI that enables IT administrators to select vendors, input employee identifiers, and execute bulk deletion operations with comprehensive logging and error handling.


Features

  • Multi-Vendor Support: Extensible architecture supports integration with multiple vendor systems
  • Dynamic Module Loading: Vendor modules are loaded dynamically from a registry configuration
  • Intuitive GUI Interface: User-friendly Tkinter-based interface for streamlined operations
  • Bulk Processing: Process multiple employee deletions in a single operation
  • Windows Profile Deletion: Automatically removes local user profiles from C:\Users\<username>
  • Comprehensive Logging: All operations are logged with timestamps to logs/offboarding.log
  • Error Handling: Robust exception handling with detailed error reporting
  • Threaded Execution: Non-blocking GUI during offboarding operations
  • Template System: Includes vendor template for rapid integration of new vendors

Requirements

  • Python: 3.8 or higher
  • Operating System: Windows (required for local profile deletion functionality)
  • Dependencies:
    • Tkinter (typically included with Python on Windows)
    • All other dependencies are part of the Python standard library

Installation

  1. Clone or download the repository

    git clone <repository-url>
    cd Auto_Delete_Profile

    Or extract the project folder to your desired location.

  2. Verify Python installation

    python --version

    Ensure Python 3.8 or higher is installed.

  3. Navigate to project directory

    cd Auto_Delete_Profile
  4. Run the application

    python Auto_Delete_Profile.py

The application will launch with the GUI interface. The logs/ directory will be created automatically on first run.


How to Use

Launching the Application

  1. Open a terminal or command prompt
  2. Navigate to the Auto_Delete_Profile directory
  3. Run: python Auto_Delete_Profile.py

Using the GUI Interface

  1. Select a Vendor

    • Use the dropdown menu labeled "Select Vendor"
    • Choose the vendor organization for which you want to perform offboarding
  2. Enter Employee IDs

    • In the text area, enter employee usernames or IDs
    • Enter one identifier per line
    • Example:
      employee001
      employee002
      employee003
      
  3. Run Offboarding

    • Click the "Run Offboarding" button
    • The button will be disabled during processing
    • Monitor progress in the output console below
  4. Review Results

    • The output console displays real-time status updates
    • A summary is shown after completion
    • Check logs/offboarding.log for detailed audit trail
  5. Clear Output (optional)

    • Click "Clear Output" to clear the console display

How It Works

The application follows a multi-stage workflow for each employee:

  1. Vendor Deletion: Calls the vendor-specific module's delete_employees() function
  2. Local Profile Deletion: Removes the Windows user profile from C:\Users\<username>
  3. Logging: All operations are logged with timestamps and status
  4. Error Handling: Failures for individual employees don't stop processing of others

The system processes employees sequentially but runs in a separate thread to keep the GUI responsive. Each operation's success or failure is tracked and reported.


Architecture

The application follows a modular architecture with clear separation of concerns:

┌─────────────────────────────────────────────────────────┐
│                    main_gui.py                          │
│                   (Tkinter GUI)                         │
│              (OffboardingGUI class)                     │
└─────────────────────┬───────────────────────────────────┘
                      │
                      ▼
┌─────────────────────────────────────────────────────────┐
│            employee_offboarding_engine.py               │
│              (Orchestration Layer)                      │
│           (OffboardingEngine class)                     │
└──────────┬─────────────────────────────┬────────────────┘
           │                             │
           ▼                             ▼
┌─────────────────────┐    ┌─────────────────────────────┐
│ vendor_employee_    │    │   local_profile_delete.py   │
│ loader.py           │    │   (Windows Profile Removal) │
│ (Dynamic Loading)   │    │   delete_local_profile()    │
└─────────┬───────────┘    └─────────────────────────────┘
          │
          ▼
┌─────────────────────┐
│  vendors/*.py       │
│  (Vendor Modules)   │
│  delete_employees() │
└─────────────────────┘

Component Responsibilities

  • Auto_Delete_Profile.py: Application entry point that launches the GUI
  • gui/main_gui.py: Tkinter interface handling user input and displaying results
  • core/employee_offboarding_engine.py: Orchestrates the offboarding workflow
  • core/vendor_employee_loader.py: Dynamically loads vendor modules from registry
  • core/local_profile_delete.py: Handles Windows profile directory deletion
  • core/logger.py: Centralized logging configuration
  • core/vendor_employee_registry.json: Configuration mapping vendor names to modules
  • vendors/*.py: Vendor-specific deletion implementations

Adding New Vendors

To integrate a new vendor into the system:

Step 1: Create Vendor Module

  1. Copy vendors/template_vendor_employee.py to vendors/your_vendor_name.py

  2. Replace the placeholder logic in delete_employees() with your vendor's API calls or deletion logic

  3. Ensure the function returns a list of dictionaries with this structure:

    [
        {
            "employee": "employee_id",
            "success": True,
            "message": "Description of operation"
        }
    ]

Step 2: Register Vendor

  1. Open core/vendor_employee_registry.json

  2. Add an entry mapping the display name to the module path:

    {
        "Allied Universal": "vendors.allied_universal",
        "Your Vendor Name": "vendors.your_vendor_name"
    }

Step 3: Test

  1. Restart the application
  2. Verify your vendor appears in the dropdown menu
  3. Test with sample employee data

Vendor Module Requirements

  • Must implement delete_employees(employee_list: List[str]) -> List[Dict]
  • Should use the logger from core.logger for consistent logging
  • Should handle errors gracefully and return appropriate success/failure status

Local Profile Deletion

The application automatically deletes Windows local user profile directories as part of the offboarding process.

Process

  • Target Path: C:\Users\<username>
  • Method: Uses shutil.rmtree() with error handling
  • Safety Checks:
    • Verifies directory exists before deletion
    • Handles permission errors gracefully
    • Logs all operations for audit purposes

Requirements

  • Administrator privileges may be required for some profile deletions
  • Profiles that are currently in use may fail with permission errors
  • The operation will attempt deletion but will log failures without stopping the overall process

Error Handling

Common scenarios:

  • Profile doesn't exist: Logged as informational (may have been already deleted)
  • Permission denied: Logged as error (profile may be in use)
  • File in use: Logged as error with details

All errors are logged to both the console output and the log file.


Logging

All operations are logged to logs/offboarding.log with the following format:

YYYY-MM-DD HH:MM:SS | LEVEL | MODULE_NAME | MESSAGE

Log Features

  • Rotation: Log files rotate when they reach 10MB
  • Retention: Keeps 5 backup files
  • Encoding: UTF-8 encoding for proper character support
  • Dual Output: Logs appear in both the file and console

Log Location

  • File: logs/offboarding.log
  • Directory: Automatically created on first run

Example Log Entry

2024-01-15 14:30:25 | INFO | core.employee_offboarding_engine | Starting offboarding for vendor 'Allied Universal' with 3 employees
2024-01-15 14:30:26 | INFO | vendors.allied_universal | [Allied Universal] Processing removal: employee001
2024-01-15 14:30:27 | INFO | core.local_profile_delete | Successfully deleted local profile: C:\Users\employee001

Future Enhancements

Potential improvements and extensions:

  • Active Directory Integration: Automatically disable AD accounts during offboarding
  • Email Notifications: Send completion emails to administrators
  • Database Logging: Store offboarding history in a database for reporting
  • Batch Import: Load employee lists from CSV or Excel files
  • Scheduled Operations: Support for scheduled offboarding runs
  • Web Dashboard: Browser-based interface as alternative to desktop GUI
  • Multi-Threading: Parallel processing for faster bulk operations
  • Progress Bars: Visual progress indicators for long-running operations
  • Rollback Capabilities: Undo mechanisms for accidental deletions
  • Configuration File: External configuration for default settings
  • Audit Reports: Generate PDF or HTML reports of offboarding operations

Security Considerations

  • Access Control: Restrict application access to authorized IT personnel only
  • Audit Logging: All operations are logged for compliance and auditing
  • Employee Data: Handle employee identifiers in accordance with data protection policies
  • Vendor Credentials: Store API keys and tokens securely (use environment variables or secure vaults)
  • Network Security: Ensure vendor API connections use encrypted protocols (HTTPS/TLS)
  • Error Messages: Avoid exposing sensitive information in error messages
  • Code Review: Review vendor module implementations before production deployment

Important: This tool performs destructive operations. Ensure appropriate safeguards, confirmation workflows, or approval processes are in place per your organization's policies.


Troubleshooting

GUI Won't Launch

  • Verify Python 3.8+ is installed: python --version
  • Ensure Tkinter is available (included with standard Python on Windows)
  • Check for syntax errors: python -m py_compile Auto_Delete_Profile.py

Vendor Not Appearing

  • Verify the vendor is registered in core/vendor_employee_registry.json
  • Check the module path matches the actual file location
  • Ensure the vendor module file exists and has no syntax errors
  • Review logs/offboarding.log for import errors

Profile Deletion Fails

  • Ensure the application is running with appropriate permissions
  • Check if the profile is currently in use (user logged in)
  • Verify the profile path exists: C:\Users\<username>
  • Review log file for specific error messages

Import Errors

  • Ensure you're running from the project root directory
  • Verify all __init__.py files are present
  • Check that module paths in the registry match actual file locations

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright (c) 2025 [Your Name]


Contact / Owner

For questions, issues, or contributions related to Auto Delete Profile, please contact the development team or repository owner.


Version: 1.0.0
Last Updated: 2024

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages