AccessUsers und AccessGroups
Hi,
it's not clear how to use Add-PodeWebPage with -AccessUsers and -AccessGroups. If I enter a user or group, then this page disappears altogether. Can someone shed some light on how this works.
The question is how to hide some pages for some and show for others.
Thanks
Hi @eugen257,
The two work if authentication/login is enabled. -AccessUsers is an array of usernames that can access the page, and -AccessGroups is an array of groups for users that can access the page. If a user's username, or a user's group isn't in either, the page is hidden.
If you've got WindowsAD auth enabled say, and a user with username joe.bloggs logged in, if this username is in -AccessUsers for some page then that page will show. But if a jane.doe logged in and their username wasn't in that list, the page would be hidden.
-AccessUsers checks the $WebEvent.Auth.User.Username property, and -AccessGroups checks the $WebEvent.Auth.User.Groups property.
I've noticed these are missing from the docs; so I'll label this as documentation to get it added.
Hi @Badgerati,
what's wrong? no user can see this page example:
#Login
Enable-PodeSessionMiddleware -Secret 'stringisadatatype' -Duration 600 -Extend
New-PodeAuthScheme -Form | Add-PodeAuthWindowsAd -Name 'Login' -Users @('testuser1','testuser2') -SuccessUseOrigin
Set-PodeWebLoginPage -Authentication Login -PassThru |
Register-PodeWebPageEvent -Type Load -NoAuthentication -ScriptBlock {
Show-PodeWebToast -Message "Willkommen auf unserer internen Webseite!" -Duration 10000 -Title "TestSeite"
}
#Page
Add-PodeWebPage -Name Test -Title "Test" -AccessUsers @('testuser1') -ScriptBlock {
New-PodeWebBadge -Colour Blue -Id test -Value test
}