Dynamic side navigation menu in dashboard


We’re using a dashboard in Powershell Universal to automate all sorts of things for our IT department.
I’m running PU under IIS with Windows Authentication.

I would like the sidenav menu in Dashboard to be dynamic, based on the role a user has.
In the old version this could be done with:
New-UDSideNav -Endpoint { }

In the current framework, the -Navigation argument on pages can be used to setup a custom navigation menu. But, how do I make that menu dynamic?

For reference, this is the code I use now (which isn’t dynamic):

$Navigation = @(
New-UDListItem -Label "Home" -Icon (New-UDIcon -Icon home -Size 2x) -OnClick {Invoke-UDRedirect -Url './'}
New-UDListItem -Label "IT Ondersteuning" -Icon (New-UDIcon -Icon wrench -Size 2x) -Children {
    New-UDListItem -Label "Zoek medewerker" -Icon (New-UDIcon -Icon user -Size 2x) -OnClick {Invoke-UDRedirect -Url './Zoek-gebruiker'}
    New-UDListItem -Label "Zoek token" -Icon (New-UDIcon -Icon tag -Size 2x) -OnClick { Invoke-UDRedirect -Url './Zoek-token' }

Pages | ForEach-Object { .Navigation = Navigation .NavigationLayout = “permanent”

Product: PowerShell Universal
Version: 1.5.9

@adam @adamdriscoll could you point me in the right direction please?

hey @solutionsource ,

I updated the docs with an example: Pages - PowerShell Universal

That’s exactly what I needed. Will try immediately. Thanks @adam !