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
Hi just wondering what replaces Access.HasAccces(
I'm doing an upgrade from 4->7 and it is deprecated and I'd like to know how to query access for an arbitrary member id thanks :)
there is an umbraco helper method you can use in views
but if you want to do it for named users - you need to use the PublicAccessService.
PublicAccessService.HasAccess(path, GetCurrentMember(), Roles.Provider);
as an example.
var memberId = 1;
var member = Membership.GetUser(memberId);
var access = ApplicationContext.Services.PublicAccessService.HasAccess(Model.Path, member, Roles.Provider);
Ordinarily advice is you should avoid using the services in views, but this is all the MemberHasAccess helper actually does.
I would also wrap this in some helper code, it doesn't seem very neat to leave in a razor view.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted