Skip to content

Commit 8509fbd

Browse files
committed
fix default user settings when none specified
1 parent 93b0b2c commit 8509fbd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserSettings.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ function Invoke-ListUserSettings {
2020
$UserSettings = $UserSettings.JSON | ConvertFrom-Json -Depth 10 -ErrorAction SilentlyContinue
2121
} catch {
2222
Write-Warning "Failed to convert UserSettings JSON: $($_.Exception.Message)"
23+
}
24+
25+
if (!$UserSettings) {
2326
$UserSettings = [pscustomobject]@{
2427
direction = 'ltr'
2528
paletteMode = 'light'
@@ -36,8 +39,7 @@ function Invoke-ListUserSettings {
3639
try {
3740
$UserSpecificSettings = Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq 'UserSettings' and RowKey eq '$Username'"
3841
$UserSpecificSettings = $UserSpecificSettings.JSON | ConvertFrom-Json -Depth 10 -ErrorAction SilentlyContinue
39-
}
40-
catch {
42+
} catch {
4143
Write-Warning "Failed to convert UserSpecificSettings JSON: $($_.Exception.Message)"
4244
}
4345

0 commit comments

Comments
 (0)