raymix
August 17, 2020, 10:37pm
1
I can’t seem to find any documentation for this, but in UD v2 I could do below for Role based auth
New-UDPage -Title 'Home Page' -AuthorizedRole @("Administrator", "User") -Content {
"Available to everyone"
}
How does it work in v3 now?
Do I just manually check $Roles variable on each page and return
early if not authorized?
Also how does claims work now?
Can I write $User.Claims within authentication.ps1 script and access it from Roles.ps1?
raymix
August 18, 2020, 3:44pm
3
Yeah, I’ve used those 2 pages extensively while migrating my v2 dashboard to v3
The documentation mentions $Roles variable replacing older Get-UDAuthorizationPolicy cmdlet, but it never explains alternative for -AuthorizedRole param since that was also removed from New-UDPage.
raymix
August 20, 2020, 8:55pm
4
This is what I am using right now, it feels a bit excessive coming from v2
New-UDPage -id 'Page: Dell Warranty Report' -Name 'Dell Warranty Report' -Url 'dell_warranty' -Content {
Get-AppBar
if ($false -eq (Get-PageAuthorization -Page 'Dell Warranty Report')) {
New-UDTypography -Text 'Unauthorized access to page'
break
}
New-UDTypography -Text 'Hello! This is Dell Warranty Report page'
}