Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Using c# how can I get a list of the Roles assigned to a page - I have set up Public Access roles using the CMS but not sure how I can get this list of roles into an object?
I'm pretty sure you would have to map the roles to an object yourself, manually. I'm not sure if this will help you but I'm guessing you want to check if a member has access to a certain page. If this is the case you could approach it from a different angle...
if (Umbraco.MemberHasAccess(content.Id, content.Path))
Hopefully that helps :)
Thanks for the reply - unfortunately we don't want to check if they have access but we do need the list of Permitted user groups for that page.
This should work...
var roles = umbraco.cms.businesslogic.web.Access.GetAccessingMembershipRoles(content.Id,content.Path);
Perfect - that's exactly what I wanted - thanks
What's the current alternative to GetAccessingMembershipRoles?
Because umbraco 7.6 highlights umbraco.cms.businesslogic.web.Access as obsolete and tells to use IPublicAccessService
I was unable to find out how to use it, 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.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted