Try our conversational search powered by Generative AI!

Check access for specific user

Vote:
 

Ok, I'm probably stupid, but I just can't figure this one out neither using reflector or google. How do I check access rights to a page for a specific user?

The ACL.QueryDistinctAccess accepts an IPrincipal object, but how can I get one like that? If I was using the currently logged in user I would use Page.User to find the IPrincipal, but now I need to go from an EPiServerProfile object. I can get the user name, a MembershipUser object etc. from that, but I can't find a path to IPrincipal. Or can I use a different way than ACL.QueryDistinctAccess?

#29066
Apr 03, 2009 11:55
Vote:
 
Have you tried EPiServer.Security.PrincipalInfo.CreatePrincipal(username)?
#29068
Apr 03, 2009 12:39
Vote:
 

Looks like it would do the trick, I'll try it. Thanks!

#29069
Apr 03, 2009 12:47
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.