$Roles not working in New-UDSideNav?

Hello,

I try to migrate my dashboard 2.9.0 under Powershell Universal Dashboard 2.9.6.
Everything works except the navigation menu where the display is done according to the rights …
Authentication is done through Azure (OIDC).
The rights work without worry on the pages and without rights the navigation menu works well.

My dashboard.ps1 file :

$Cache:RootFolder = "$PSScriptRoot\mydashboard"

$Pages = Get-ChildItem (Join-Path $Cache:RootFolder 'pages') -Recurse -File -Include '*.ps1' | ForEach-Object {
	. $_.FullName
}

$DashboardProps = @{
    Navigation = . (Join-Path $Cache:RootFolder "Navigation.ps1")
    Pages = $Pages
    Theme = . (Join-Path $Cache:RootFolder "themes\default.ps1")
    Title = "My dashboard" 
}
New-UDDashboard @DashboardProps

And my Navigation.ps1 file :

New-UDSideNav -Content {
	
	# Menu Accueil	
	New-UDSideNavItem -Text "Accueil" -Url "home" -Icon home
	New-UDSideNavItem -Divider
	
	# Menu Développement
	if ($Roles -contains "Development")
	{
		New-UDSideNavItem -Text "Test" -Icon flask -Children {
			Get-ChildItem -Path "$Cache:RootFolder\pages\Test\*.ps1" -File | ForEach-Object {
				New-UDSideNavItem -Text $_.BaseName -Url "test/$($_.BaseName)" -Icon flask
			}
		}
		New-UDSideNavItem -Divider
	}

       # many other menus with rights ... 
}
	

Is $Roles not taken into account before launching the New-UDDashboard command?
or maybe I didn’t understand something.

Thanks for your time and help

Product: PowerShell Universal
Version: 1.4.7
Product: Universal Dashboard
Version: 2.9.7

I don’t think they will work in -Content. Can you try using -Endpoint?

New-UDSideNav -Endpoint {

Sorry, this is a leftover from many tests.
My first tests were with -endpoint but it didn’t work.

I just tried this and there’s a bug here. The endpoint parameter is not working properly. I’ll get this fixed for 1.4.8

1 Like

Thank you! I think that was the only thing blocking me to migrate. :slight_smile: