# onurtasci/cpanelresellertransfer architecture

> Architecture diagram of the GitHub repository onurtasci/cpanelresellertransfer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/onurtasci/cpanelresellertransfer
- Repository: https://github.com/onurtasci/cpanelresellertransfer

## Overview

##### Project Type and Purpose
- This is a WHM/cPanel plugin (“resellertransfer”) written in Perl and delivered as a CGI application.
- Purpose: Add a “Reseller Transfer” feature to the WHM interface that lets an admin list resellers and reset their passwords via AJAX calls to the cPanel API.

##### File‐Structure Analysis
- Top level:
- resellertransfer.cgi (plugin entry point; registered by resellertransfer.conf)
- resellertransfer.conf (cPanel registration file, hooks plugin into WHM)
- LICENSE.md, README (meta / install instructions)
- functions.pl (common business‐logic wrappers around cPanel API calls)
- ajax/:
- cpanel.pl (generic AJAX dispatcher)
- cpanel/getList.pl, cpanel/resetPassword.pl (endpoints invoked by JS)
- assets/:
- css/ (dataTables.checkboxes.css for table UI)
- js/ (JavaScript to call AJAX endpoints, handle DOM)
- page/:
- hasroot.pl (permission check page)
- home.pl (main UI page for the plugin)

##### Key Components
a. WHM/cPanel Platform
b. Plugin Registration (resellertransfer.conf)
c. CGI Application Entry Point (resellertransfer.cgi)
d. UI Layer
- Static assets: CSS, JS
- home.pl (renders HTML)
e. AJAX Controller Layer
- ajax/cpanel.pl (router)
- getList.pl, resetPassword.pl (handlers)
f. Business Logic Layer (functions.pl)
g. External Service: cPanel’s API (UAPI or XML-API)
h. Authentication & Authorization (hasroot.pl)

##### Relationships and Data Flow
1. Admin clicks “Reseller Transfer” in WHM → WHM loads home.pl via resellertransfer.cgi
2. home.pl serves HTML + references CSS/JS assets
3. JS issues AJAX to ajax/cpanel.pl?func=getList → routed to getList.pl
4. getList.pl calls functions.pl → interacts with cPanel API → returns JSON list
5. JS populates table; on “Reset Password,” JS calls resetPassword.pl
6. resetPassword.pl calls functions.pl → performs UAPI/API call → returns status
7. JS displays success/failure

##### Architectural Patterns & Principles
- Separation of concerns:
- Presentation (home.pl + static assets)
- Controllers (ajax/*.pl)
- Business logic (functions.pl)
- Plugin registration isolating it from core WHM code
- Use of REST-style AJAX endpoints
- Lightweight CGI scripts (no heavyweight framework)

## Diagram (Mermaid)

```mermaid
flowchart TD
    Admin["Admin"]:::user

    subgraph "WHM Platform & Plugin Registration"
        RTCONF["resellertransfer.conf"]:::blue
        RTcgi["resellertransfer.cgi"]:::blue
    end

    subgraph "Presentation Layer"
        HAS["hasroot.pl"]:::green
        HOME["home.pl"]:::green
        CSS["dataTables.checkboxes.css"]:::green
        JS["assets/js/"]:::green
    end

    subgraph "Controller Layer"
        DISPATCH["cpanel.pl"]:::orange
        GET["getList.pl"]:::orange
        RESET["resetPassword.pl"]:::orange
    end

    FUNC["functions.pl"]:::yellow

    subgraph "External Service"
        API["cPanel API"]:::purple
    end

    Admin -->|"click Reseller Transfer"| RTcgi
    RTcgi -->|"loads"| HOME
    HOME -->|"permission check"| HAS
    HOME -->|"serves HTML refs"| CSS
    HOME -->|"serves HTML refs"| JS
    JS -->|"AJAX GET/POST JSON"| DISPATCH
    DISPATCH -->|"func=getList"| GET
    DISPATCH -->|"func=resetPassword"| RESET
    GET -->|"calls"| FUNC
    RESET -->|"calls"| FUNC
    FUNC -->|"UAPI/XML-API"| API

    click RTCONF "https://github.com/onurtasci/cpanelresellertransfer/blob/main/resellertransfer.conf"
    click RTcgi "https://github.com/onurtasci/cpanelresellertransfer/blob/main/resellertransfer.cgi"
    click HOME "https://github.com/onurtasci/cpanelresellertransfer/blob/main/page/home.pl"
    click HAS "https://github.com/onurtasci/cpanelresellertransfer/blob/main/page/hasroot.pl"
    click CSS "https://github.com/onurtasci/cpanelresellertransfer/blob/main/assets/css/dataTables.checkboxes.css"
    click JS "https://github.com/onurtasci/cpanelresellertransfer/tree/main/assets/js/"
    click DISPATCH "https://github.com/onurtasci/cpanelresellertransfer/blob/main/ajax/cpanel.pl"
    click GET "https://github.com/onurtasci/cpanelresellertransfer/blob/main/ajax/cpanel/getList.pl"
    click RESET "https://github.com/onurtasci/cpanelresellertransfer/blob/main/ajax/cpanel/resetPassword.pl"
    click FUNC "https://github.com/onurtasci/cpanelresellertransfer/blob/main/functions.pl"

    classDef blue fill:#E0F7FA,stroke:#0277BD,color:#000
    classDef green fill:#E8F5E9,stroke:#2E7D32,color:#000
    classDef orange fill:#FFF3E0,stroke:#F57C00,color:#000
    classDef yellow fill:#FFF9C4,stroke:#F9A825,color:#000
    classDef purple fill:#E1BEE7,stroke:#8E24AA,color:#000
    classDef user fill:#FFECB3,stroke:#FBC02D,color:#000
```
