WIp - fix login into central
This commit is contained in:
@@ -1,8 +1,53 @@
|
||||
# Tenant Migration Scripts
|
||||
# Tenant Migration & Admin Scripts
|
||||
|
||||
This directory contains scripts for managing database migrations across all tenants in the multi-tenant platform.
|
||||
This directory contains scripts for managing database migrations across all tenants and creating admin users in the multi-tenant platform.
|
||||
|
||||
## Available Scripts
|
||||
## Admin User Management
|
||||
|
||||
### Create Central Admin User
|
||||
|
||||
```bash
|
||||
npm run create-central-admin
|
||||
```
|
||||
|
||||
Creates an administrator user in the **central database**. Central admins can:
|
||||
- Manage tenants (create, update, delete)
|
||||
- Access platform-wide administration features
|
||||
- View all tenant information
|
||||
- Manage tenant provisioning
|
||||
|
||||
**Interactive Mode:**
|
||||
```bash
|
||||
npm run create-central-admin
|
||||
# You will be prompted for:
|
||||
# - Email
|
||||
# - Password
|
||||
# - First Name (optional)
|
||||
# - Last Name (optional)
|
||||
# - Role (admin or superadmin)
|
||||
```
|
||||
|
||||
**Non-Interactive Mode (using environment variables):**
|
||||
```bash
|
||||
EMAIL=admin@example.com PASSWORD=securepass123 FIRST_NAME=John LAST_NAME=Doe ROLE=superadmin npm run create-central-admin
|
||||
```
|
||||
|
||||
**Logging In as Central Admin:**
|
||||
1. Access the application using a central subdomain (e.g., `central.yourdomain.com` or `admin.yourdomain.com`)
|
||||
2. Enter your central admin credentials
|
||||
3. You'll be authenticated against the central database (not a tenant database)
|
||||
|
||||
**Note:** The system automatically detects if you're logging in from a central subdomain based on the `CENTRAL_SUBDOMAINS` environment variable (defaults to `central,admin`). No special UI or configuration is needed on the frontend.
|
||||
|
||||
### Create Tenant User
|
||||
|
||||
For creating users within a specific tenant database, use:
|
||||
```bash
|
||||
npm run create-tenant-user <tenant-slug>
|
||||
# (Note: This script may need to be created or already exists)
|
||||
```
|
||||
|
||||
## Migration Scripts
|
||||
|
||||
### 1. Create a New Migration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user