Reputation: 2156
What's the current alternative to umbraco.cms.businesslogic.web.Access.GetAccessingMembershipRoles
? Because umbraco 7.6 highlights it as obsolete and tells to use IPublicAccessService
I was unable to find out how to use it though, all I got to was
IContent content = GetById(id);
Attempt<PublicAccessEntry> access = _publicAccessService.IsProtected(content);
which doesn't have any information about the current page roles.
Upvotes: 1
Views: 546
Reputation: 1781
This is how you do it;
IContent content = GetById(id);
var publicAccessService = ApplicationContext.Current.Services.PublicAccessService;
var entryForContent = publicAccessService.GetEntryForContent(content);
You will see that entryForContent result has got Rules and this is what you need. See details below;
Upvotes: 5