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

8
data/companies.json Normal file
View File

@@ -0,0 +1,8 @@
[
{
"id": "cuitunet",
"nimi": "CuituNet",
"luotu": "2026-03-10 08:58:43",
"aktiivinen": true
}
]