Add multi-tenant support with per-company data isolation

Implement full multi-company architecture:
- Per-company directory structure (data/companies/{id}/)
- Automatic migration from single-tenant to multi-tenant
- Company management admin tab (create, edit, delete companies)
- Per-company IMAP mailbox configuration (multiple mailboxes per company)
- User access control per company (companies array on users)
- Company switcher in header (shown when user has access to >1 company)
- Session-based company context with check_auth fallback for old sessions
- Ticket list shows mailbox name instead of sender
- IMAP settings moved from global config to company-specific config
- All data endpoints protected with requireCompany() guard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 11:04:24 +02:00
parent 562153e040
commit c34b5a2c26
6 changed files with 1123 additions and 203 deletions

View File

@@ -1321,3 +1321,43 @@ span.empty {
color: #999;
font-size: 0.85rem;
}
/* Company selector */
.company-selector {
margin-left: 1.5rem;
padding: 6px 12px;
border: 2px solid #e0e0e0;
border-radius: 8px;
font-size: 0.88rem;
font-weight: 600;
color: #0f3460;
background: #f8f9fb;
cursor: pointer;
transition: border-color 0.2s;
}
.company-selector:hover,
.company-selector:focus {
border-color: #0f3460;
outline: none;
}
/* Mailbox items */
.mailbox-item {
transition: border-color 0.2s;
}
.mailbox-item:hover {
border-color: #0f3460 !important;
}
/* Company badge */
.company-badge {
display: inline-block;
padding: 2px 8px;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 600;
background: #e8f0fe;
color: #1a56db;
}