Skip to content

Instantly share code, notes, and snippets.

@casper-rasmussen
Created August 5, 2016 14:31
Show Gist options
  • Save casper-rasmussen/4458f8b3fb7e5bdb72ded4ea3bdfd86b to your computer and use it in GitHub Desktop.
Save casper-rasmussen/4458f8b3fb7e5bdb72ded4ea3bdfd86b to your computer and use it in GitHub Desktop.
public class IsEditingCommerceRole : VirtualRoleProviderBase
{
public const string Name = "IsEditingCommerceRole";
private readonly IContentRepository _contentRepository;
public IsEditingCommerceRole()
{
this._contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
}
public override bool IsInVirtualRole(IPrincipal principal, object context)
{
IContent startPage = this._contentRepository.Get<IContent>(ContentReference.StartPage);
//Replace logic with your logic on how to determine what site editor visits.
return startPage is CommerceSiteStartPage;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment