- Domain-Entity polymorph (Reseller ODER Firma) - TenantResolver: Host → Plattform / reseller.portal / firma.reseller.portal / verifizierte Custom-Domain - Öffentliches GET /api/branding (Name, Ebene, Farben, Logo) nach Host - TLS-Gate nutzt TenantResolver (nur bekannte Hosts → Zertifikat) - Frontend: Branding-Store lädt vor Mount, färbt Theme um, TenantBrand- Komponente (Logo/Name je Tenant), Login zeigt Tenant - Vite-Proxy reicht Original-Host durch (lokales White-Label-Testing) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Service;
|
|
|
|
use App\Entity\Company;
|
|
use App\Entity\Reseller;
|
|
|
|
/**
|
|
* Ergebnis der Host-Auflösung (siehe TenantResolver): welche Ebene/welcher
|
|
* Mandant gehört zum aufgerufenen Hostnamen.
|
|
*/
|
|
final readonly class ResolvedTenant
|
|
{
|
|
public const KIND_PLATFORM = 'platform';
|
|
public const KIND_RESELLER = 'reseller';
|
|
public const KIND_COMPANY = 'company';
|
|
|
|
public function __construct(
|
|
public string $kind,
|
|
public ?Reseller $reseller = null,
|
|
public ?Company $company = null,
|
|
/** true = eigene Domain des Kunden, false = Standard-Subdomain/Portal. */
|
|
public bool $customDomain = false,
|
|
) {
|
|
}
|
|
|
|
public static function platform(): self
|
|
{
|
|
return new self(self::KIND_PLATFORM);
|
|
}
|
|
|
|
public function isPlatform(): bool
|
|
{
|
|
return self::KIND_PLATFORM === $this->kind;
|
|
}
|
|
|
|
public function isReseller(): bool
|
|
{
|
|
return self::KIND_RESELLER === $this->kind;
|
|
}
|
|
|
|
public function isCompany(): bool
|
|
{
|
|
return self::KIND_COMPANY === $this->kind;
|
|
}
|
|
}
|