Check access for specific user

Magnus Rahl
Member since: 2008
 

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
henriknystrom
Member since: 2004
 
Have you tried EPiServer.Security.PrincipalInfo.CreatePrincipal(username)?
#29068
Apr 03, 2009 12:39
Magnus Rahl
Member since: 2008
 

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.