# Tenant Management {#tenant-management}


MQUAD is a multi-tenant platform where each tenant (workspace) operates as an isolated environment with its own users, surveys, data, and configuration.


## Workspace Administration {#workspace-administration}


Host Admins manage tenants from the **Tenants** section:

1. Go to **Admin Panel > Tenants** to see all active workspaces.
2. Each tenant shows: name, URL, status (active/suspended), user count, survey count, storage used, and subscription plan.
3. Click a tenant to view detailed information and management options.


### Creating a New Tenant {#creating-a-new-tenant}


1. Click **Create Tenant**.
2. Enter:
   - **Workspace Name** — Display name for the workspace
   - **Subdomain** — The workspace's unique MQUAD subdomain (e.g., `research.mquad.org`)
   - **Custom Domain** — Optionally configure a custom domain (e.g., `surveys.researchorg.org`)
   - **Owner Email** — The user who becomes the workspace admin
3. Select the **Subscription Plan** for the tenant.
4. Click **Create**. The tenant is provisioned with its own namespace and isolated data records.


### Suspending a Tenant {#suspending-a-tenant}


If a tenant violates terms or payment is overdue:

1. Click the tenant to open its details.
2. Click **Suspend Tenant**.
3. Optionally provide a reason (visible to the tenant admin).
4. Confirmed suspension immediately blocks all access to the workspace. A suspension notice is shown to users on login.


## Tenant Isolation {#tenant-isolation}


Each tenant is logically isolated to ensure data privacy and security:

- **Logical Isolation** — All data is stored in shared databases but isolated at the application level via the `tenant_id` mandatory filter. No cross-tenant data access is possible.
- **Storage Isolation** — File uploads are stored as objects in tenant-specific folders or buckets.
- **Authentication Isolation** — User accounts are scoped to tenants through their assigned permissions and organizations.
- **Rate Limiting** — Tenant-level quotas prevent any single workspace from overwhelming system resources.


## Branding {#branding}


Workspace admins can customize their tenant's appearance:

1. Go to **Workspace Settings > Branding**.
2. Configure:
   - **Logo** — Upload your organization's logo (PNG or SVG, max 2 MB)
   - **Favicon** — Browser tab icon
   - **Primary Color** — Brand color for buttons, headers, and links
   - **Secondary Color** — Accent color for highlights and borders
   - **Custom CSS** — Advanced users can inject custom stylesheets
3. **Preview** shows how the branding looks on survey pages and the dashboard.
4. Click **Save Changes**.

Branding applies to all survey pages, email invitations, and the workspace dashboard.


## Tenant-Level Settings {#tenant-level-settings}


Configure workspace-wide defaults under **Workspace Settings > General**:

- **Default Language** — Interface language for new users
- **Timezone** — Default timezone for all timestamps
- **Date Format** — Display format (MM/DD/YYYY, DD/MM/YYYY, etc.)
- **Storage Limit** — Maximum file storage for uploads
- **User Limit** — Maximum number of active users
- **Session Timeout** — Auto-logout after inactivity (minutes)
- **Password Policy** — Minimum length, complexity requirements, expiration
- **Allowed IP Ranges** — Restrict workspace access to specific IPs


## Data Retention {#data-retention}


Configure data retention policies under **Workspace Settings > Data**:

- **Response Retention** — Auto-delete responses older than N months
- **Survey Retention** — Auto-close surveys inactive for N months
- **Export Cleanup** — Auto-delete export files after N days
- **Log Retention** — Retain audit logs for N months (minimum 12 by default)


## Deletion {#deletion}


To permanently delete a tenant (irreversible):

1. Go to **Admin Panel > Tenants** and select the tenant.
2. Click **Delete Tenant**.
3. Type the tenant name to confirm.
4. Data is permanently removed after a 30-day grace period (configurable).

During the grace period, the tenant can be restored by a Host Admin.
