New-UDPage -OnAccessDenial parameter?

Hey Adam,

This is a very minor thing, but as there was previously an issue with multiple roles being specified in the New-UDPage -Role parameter and so we’d implemented our own check within the page using $Roles which displayed a custom message if the person attempting to access the page doesn’t have the required role, such as:

We’re looking at switching back to using the -Role parameter in New-UDPage so that pages a user doesn’t have access to aren’t displayed in the navigation bar, but I’m wondering if it’s feasible to add a -OnAccessDenial parameter to New-UDPage to allow for custom error display should the user access the direct link, e.g. if provided that link by another user who has access?

This would allow me to tell a user three things over the generic “Page Not Found” error displayed currently when someone without the required role tries to get in:

  1. The page exists.
  2. You don’t have access.
  3. Here’s the roles that do have access if you need to request one.


Product: PowerShell Universal
Version: 2.7.4

FYI there was similar enhancement requested here, but doesn’t look like it’s marked as completed:

“Page Not Found” When User Doesn’t Have Role to Access Page · Issue #340 · ironmansoftware/issues · GitHub

We have a long standing issue for this but I think we should finally slate it for a release. I’ll see about 2.10 but if not I’ll get it into 2.11.