asdasd
This commit is contained in:
@@ -196,6 +196,10 @@ final class UserSelfManagementService
|
||||
static fn (array $app): string => (string) ($app['app_id'] ?? ''),
|
||||
$visibleApps
|
||||
)));
|
||||
$defaultEnabledAppIds = array_values(array_filter(array_map(
|
||||
static fn (array $app): ?string => ($app['enabled_by_default'] ?? false) ? (string) ($app['app_id'] ?? '') : null,
|
||||
$visibleApps
|
||||
)));
|
||||
$defaultWidgetIds = array_values(array_filter(array_map(
|
||||
static fn (array $widget): ?string => ($widget['default_enabled'] ?? false) ? (string) ($widget['widget_id'] ?? '') : null,
|
||||
$widgets
|
||||
@@ -204,13 +208,35 @@ final class UserSelfManagementService
|
||||
static fn (array $widget): string => (string) ($widget['widget_id'] ?? ''),
|
||||
$widgets
|
||||
)));
|
||||
$storedEnabledAppIds = array_key_exists('enabled_ids', (array) ($settings['apps'] ?? []))
|
||||
? $this->sanitizeSelection($settings['apps']['enabled_ids'] ?? [], $visibleAppIds)
|
||||
: $visibleAppIds;
|
||||
$knownAppIds = $this->sanitizeSelection(
|
||||
$settings['apps']['known_ids'] ?? [],
|
||||
$visibleAppIds
|
||||
);
|
||||
$newDefaultAppIds = array_values(array_filter(
|
||||
$defaultEnabledAppIds,
|
||||
static fn (string $appId): bool => !in_array($appId, $knownAppIds, true)
|
||||
));
|
||||
$enabledAppIds = $this->sanitizeSelection(
|
||||
$settings['apps']['enabled_ids'] ?? $visibleAppIds,
|
||||
array_merge($storedEnabledAppIds, $newDefaultAppIds),
|
||||
$visibleAppIds,
|
||||
[self::APP_ID]
|
||||
);
|
||||
$storedActiveWidgetIds = array_key_exists('active_ids', (array) ($settings['widgets'] ?? []))
|
||||
? $this->sanitizeSelection($settings['widgets']['active_ids'] ?? [], $allWidgetIds)
|
||||
: $defaultWidgetIds;
|
||||
$knownWidgetIds = $this->sanitizeSelection(
|
||||
$settings['widgets']['known_ids'] ?? [],
|
||||
$allWidgetIds
|
||||
);
|
||||
$newDefaultWidgetIds = array_values(array_filter(
|
||||
$defaultWidgetIds,
|
||||
static fn (string $widgetId): bool => !in_array($widgetId, $knownWidgetIds, true)
|
||||
));
|
||||
$activeWidgetIds = $this->sanitizeSelection(
|
||||
$settings['widgets']['active_ids'] ?? $defaultWidgetIds,
|
||||
array_merge($storedActiveWidgetIds, $newDefaultWidgetIds),
|
||||
$allWidgetIds
|
||||
);
|
||||
$profile = [];
|
||||
@@ -240,9 +266,11 @@ final class UserSelfManagementService
|
||||
],
|
||||
'apps' => [
|
||||
'enabled_ids' => $enabledAppIds,
|
||||
'known_ids' => $visibleAppIds,
|
||||
],
|
||||
'widgets' => [
|
||||
'active_ids' => $activeWidgetIds,
|
||||
'known_ids' => $allWidgetIds,
|
||||
],
|
||||
'integration' => [
|
||||
'ldap_write_status' => 'planned',
|
||||
|
||||
Reference in New Issue
Block a user