The issue we are having is that we would like to do an extra validation on assigned member type on pages that uses the public access.
But it does not seems like that the public access is using the MemberManager because our CustomMemberManager does not get hit when we try to debug it while trying to access a page with a member group assigned to it in the public access.
So the question is, does the public access not use the MemberManager and how would we hook into or override the validation method for it?
But it does appear it's getting the current registered IMember manager in order to get the current username and current user roles in order to do the has access check...
...so I'm not sure why your custom implementation isn't being hit :-(
It does hit our CustomMemberManager with GetUserAsync and GetRolesAsync.
But from your link it looks like it uses the IPublicAccessService with !_publicAccessService.HasAccess(publishedContentId, _contentService, username!, userRoles) to determin if the member has access.
It would have been so great if it instead took the roles and then used the MemberManager.IsMemberAuthorizedAsync(allowGroups: roles) if the ruletype is MemberRoleRuleType.
So we might wanna override the default controllers instead and add a IAuthorizationFilter with our custom memberType check.
Does public access use MemberManager?
Hi all.
Using Umbraco 13. We have created a custom MemberManager for our solution like:
And we are using it like described here https://docs.umbraco.com/umbraco-cms/reference/querying/imembermanager
The issue we are having is that we would like to do an extra validation on assigned member type on pages that uses the public access.
But it does not seems like that the public access is using the MemberManager because our CustomMemberManager does not get hit when we try to debug it while trying to access a page with a member group assigned to it in the public access.
So the question is, does the public access not use the MemberManager and how would we hook into or override the validation method for it?
Hi Bo
It looks like it is the IPublicAccessChecker that is responsible for the checking.
https://github.com/umbraco/Umbraco-CMS/blob/cc39d36ff55d5be2e3a3bdbaf38f3126a00003d3/src/Umbraco.Web.Common/Security/PublicAccessChecker.cs#L34
But it does appear it's getting the current registered IMember manager in order to get the current username and current user roles in order to do the has access check...
...so I'm not sure why your custom implementation isn't being hit :-(
I wonder if you can replace IPublicAccessChecker?
Regards
Marc
Hi Marc.
Thanks for your feedback.
It does hit our
CustomMemberManager
withGetUserAsync
andGetRolesAsync
.But from your link it looks like it uses the
IPublicAccessService
with!_publicAccessService.HasAccess(publishedContentId, _contentService, username!, userRoles)
to determin if the member has access.The method used is an extension here https://github.com/umbraco/Umbraco-CMS/blob/cc39d36ff55d5be2e3a3bdbaf38f3126a00003d3/src/Umbraco.Core/Services/PublicAccessServiceExtensions.cs#L49
And it seems like it checks the PublicAccessEntry like:
It would have been so great if it instead took the roles and then used the
MemberManager.IsMemberAuthorizedAsync(allowGroups: roles)
if the ruletype is MemberRoleRuleType.So we might wanna override the default controllers instead and add a
IAuthorizationFilter
with our custom memberType check.To answer my own question if the public access uses the MemberManager?
The answer is yes, but it does not use it like I thought it would.
Public Access uses the MemberManager's
GetUserAsync
andGetRolesAsync
.Public Access do not use the MemberManager's
MemberHasAccessAsync
orIsMemberAuthorizedAsync
.is working on a reply...