Class UserGroupTemplateExtender
- Namespace
- Dynamicweb.Frontend.UserManagement
- Assembly
- Dynamicweb.dll
Represents template extender.
public abstract class UserGroupTemplateExtender : TemplateExtender
- Inheritance
-
UserGroupTemplateExtender
- Inherited Members
Examples
using Dynamicweb.Frontend.UserManagement;
using Dynamicweb.Rendering;
using Dynamicweb.Security.UserManagement;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Dynamicweb.Examples.UserManagement;
public class GroupTemplateExtenderSample : UserGroupTemplateExtender
{
public override void ExtendTemplate(Template template)
{
template.SetTag("MyCustomGroupTag", "MyCustomGroupValue:" + Group.Name);
IEnumerable<UserGroup> subgroups = Group.GetSubgroups();
//Do some actions with subgroups.
IEnumerable<User> users = Group.GetUsers().Where(user => user.Active && user.ValidFrom <= DateTime.Now && user.ValidTo <= DateTime.Now);
//Do some actions with users.
if (Group.GetParentGroup() is not null)
{
//Do some actions with parent.
}
}
}
Properties
Group
Gets or sets the extendable Group.
public UserGroup Group { get; set; }