func NewSetManagingGroup(c tree.RefContext) (tree.GroupHook, error) {
	return &SetManagingGroup{tree.NewBaseHook("set-managing-group", 10), c.DB}, nil
}
NewSetManagingGroup returns a hook initialized for use.
package hooks
import (
	"github.com/netauth/netauth/internal/startup"
	"github.com/netauth/netauth/internal/tree"
	pb "github.com/netauth/protocol"
)
type SetManagingGroup struct {
	tree.BaseHook
	tree.DB
}
func (c *SetManagingGroup) Run(g, dg *pb.Group) error {
	if dg.GetManagedBy() == "" {
		return nil
	}
	if dg.GetName() == dg.GetManagedBy() {
		g.ManagedBy = dg.ManagedBy
		return nil
	}
	if _, err := c.LoadGroup(dg.GetManagedBy()); err != nil {
		return err
	}
	g.ManagedBy = dg.ManagedBy
	return nil
}
func init() {
	startup.RegisterCallback(setManagingGroupCB)
}
func setManagingGroupCB() {
	tree.RegisterGroupHookConstructor("set-managing-group", NewSetManagingGroup)
}