I use the code below to build my navigation dynamically based on Authorization and group memberships. The trade off is that Get-UdAuthorization takes a few seconds to run. So the navigation pane will be empty in a few seconds immediately following a refresh/page load.
I opened an enhancement issue on the speed, or lack thereof yesterday.
$Navigation = New-UDSideNav -Endpoint {
$Policies = Get-UDAuthorizationPolicy
New-UDSideNavItem -Text "Home" -PageName "Home" -Icon home
New-UDSideNavItem -Text "Consultants Dashboard" -PageName "Consultants Dashboard" -Icon hourglass_half
New-UDSideNavItem -Text "Departments" -PageName "Departments" -Icon sitemap
New-UDSideNavItem -Text "Employees Dashboard" -PageName "Employees Dashboard" -Icon User
New-UDSideNavItem -Text "Blue Collars" -PageName "BlueCollars" -Icon User
if ($Policies -contains 'Manager'){
New-UDSideNavItem -Divider
New-UDSideNavItem -Text " Manager ->" -Icon sitemap -Children {
New-UDSideNavItem -Text "Your Department" -PageName "Manager" -Icon User
}
}
if ($Policies -contains 'AdminCollection'){
New-UDSideNavItem -Divider
New-UDSideNavItem -Text " Administration ->" -Icon tools -Children {
if ($Policies -contains 'DepartmentsAdmin'){
New-UDSideNavItem -Text "Administer Departments" -PageName "Admin - Departments" -Icon sitemap
}
if ($Policies -contains 'BlueCollarsAdmin'){
New-UDSideNavItem -Text "Administer Blue Collars" -PageName "Admin - Blue Collars" -Icon users
}
if ($Policies -contains 'EmployeesAdmin'){
New-UDSideNavItem -Text "Administer Employees" -PageName "Admin - Employees" -Icon users
}
}
}
if ($Policies -contains 'LogCollection'){
New-UDSideNavItem -Divider
New-UDSideNavItem -Text " Logs ->" -Icon list -Children {
if ($Policies -contains 'LogViewerAll'){
New-UDSideNavItem -Text "Log Viewer - ALL" -PageName "LogViewer - ALL" -Icon list
}
if ($Policies -contains 'LogViewerAllDetailed'){
New-UDSideNavItem -Text "Log Viewer - ALL Detailed" -PageName "LogViewer - ALLDetailed" -Icon list
}
}
}
}