Fix SuperAdmin access sync for tenant domains and persist flags locally.
Expand www/admin domain aliases when resolving program-settings, and save owned keys to local settings after a successful refresh so menu flags like customer_special_pricing stay applied. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -309,18 +309,48 @@ class SuperAdminProgramSettingsClient
|
||||
|
||||
$out = [];
|
||||
foreach ($candidates as $host) {
|
||||
if ($host === '' || in_array($host, $out, true)) {
|
||||
continue;
|
||||
foreach ($this->expandDomainAliases($host) as $alias) {
|
||||
if ($alias === '' || in_array($alias, $out, true)) {
|
||||
continue;
|
||||
}
|
||||
if (in_array($alias, ['localhost', '127.0.0.1', '::1'], true)) {
|
||||
continue;
|
||||
}
|
||||
$out[] = $alias;
|
||||
}
|
||||
if (in_array($host, ['localhost', '127.0.0.1', '::1'], true)) {
|
||||
continue;
|
||||
}
|
||||
$out[] = $host;
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* admin.example.com / www.example.com → example.com هم امتحان شود.
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
private function expandDomainAliases(string $host): array
|
||||
{
|
||||
$host = $this->normalizeHost($host);
|
||||
if ($host === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
$aliases = [$host];
|
||||
foreach (['www.', 'admin.', 'panel.', 'app.'] as $prefix) {
|
||||
if (str_starts_with($host, $prefix)) {
|
||||
$bare = substr($host, strlen($prefix));
|
||||
if ($bare !== '') {
|
||||
$aliases[] = $bare;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! str_starts_with($host, 'www.')) {
|
||||
$aliases[] = 'www.'.$host;
|
||||
}
|
||||
|
||||
return array_values(array_unique($aliases));
|
||||
}
|
||||
|
||||
private function normalizeHost(string $value): string
|
||||
{
|
||||
$host = strtolower(trim($value));
|
||||
|
||||
Reference in New Issue
Block a user