UDSideNav and authorizaton policy

When UD natively creates a static side nav bar for static pages, users only see those items for those which whose authorization policy applies to the user.

Is there a simple way to recreate this functionality in New-UDSidNavBar?

Thanks,
Tim Curwick

I don’t know what version you were using when you posted this, but for the current version (2.5.2 at the time of writing):
You can do this using the -Endpoint parameter on New-UDSideNav, like so:

New-UDSideNav -Endpoint {
    New-UDSideNavItem -Text 'Home' -PageName 'Home'
    if($ClaimsPrincipal.Claims | Where-Object { $_.Type -like '*claims/role' -and $_.Value -like 'Admin*' }) {
        New-UDSideNavItem -Text 'Section' -Children {
            New-UDSideNavItem -Text 'Page 1' -PageName 'Page 1'
            if($ClaimsPrincipal.Claims | Where-Object { $_.Type -like '*claims/role' -and $_.Value -eq 'Admin2' }) {
                New-UDSideNavItem -Text 'Page 2' -PageName 'Page 2'
            }
        }
    }
} 
1 Like