$Roles missing from Show-UDModal

After updating from 2.7 to 2.9 the following code doesn’t work anymore.
When using Show-UDModal the $Roles variable is empty.

Is this by design or a bug?

function GetRoles
{
    New-UDTypography -Text 'Roles:'
    New-UDElement -Tag 'ul' -Content {
        $Roles | ForEach-Object { if ($_ -inotlike 'S-1-*') { New-UDElement -Tag 'li' -Content { $_ } } }
    }
}

$Pages = New-UDPage -Name 'PowerShell Universal' -Content {
    GetRoles

    New-UDButton -Text 'Show Roles' -OnClick {
        Show-UDModal -Content {
            GetRoles
        }
    }
}

New-UDDashboard -Page $Pages
1 Like

Hello @adam

I found out that this specifically doesn’t work when you use Windows authentication but if using the default forms authentication it works fine. Just tested this on a new installation of 2.10.1 and here it’s the same as the older versions.

Is it possible to fix this issue?

1 Like

Sure. I’ve opened an issue to track it here: $Roles missing in Show-UDModal when using Windows auth · Issue #1142 · ironmansoftware/issues · GitHub

1 Like