func NewSetGroupCapability(c tree.RefContext) (tree.GroupHook, error) {
	return &ManageGroupCapabilities{tree.NewBaseHook("set-group-capability", 50), true}, nil
}
NewSetGroupCapability returns a ManageGroupCapability hook
pre-configured into the additive mode.
package hooks
import (
	"github.com/netauth/netauth/internal/startup"
	"github.com/netauth/netauth/internal/tree"
	pb "github.com/netauth/protocol"
)
type ManageGroupCapabilities struct {
	tree.BaseHook
	mode bool
}
func (mec *ManageGroupCapabilities) Run(g, dg *pb.Group) error {
	if len(dg.Capabilities) == 0 {
		return tree.ErrUnknownCapability
	}
	for _, cap := range dg.Capabilities {
		if mec.mode {
			g.Capabilities = addCapability(cap, g.Capabilities)
		} else {
			g.Capabilities = delCapability(cap, g.Capabilities)
		}
	}
	return nil
}
func init() {
	startup.RegisterCallback(groupCapabilitiesCB)
}
func groupCapabilitiesCB() {
	tree.RegisterGroupHookConstructor("set-group-capability", NewSetGroupCapability)
	tree.RegisterGroupHookConstructor("remove-group-capability", NewRemoveGroupCapability)
}