I found the code sample in another post http://developer.dynamicweb-cms.com/forum/development/manipulate-grouplist-before-render.aspx
using Dynamicweb;
using Dynamicweb.eCommerce.Products;
namespace CustomModules1
{
public class GroupTemplateExtender1 : GroupTemplateExtender
{
public override void ExtendTemplate(Dynamicweb.Templatev2.Template template)
{
string userID = User.UserID.ToString();
string groupID = Group.ID;
string requiredUserGroup = "291";//example user group
//make permission check
//User.Groups contains array of groups where the user presents
bool condition = User.Groups.Contains(requiredUserGroup);
if (condition)
{
template.SetTag("Custom.CheckHasAccess", "true");
}
else
{
//nothing to do.
}
}
}
}