Rework actions to be loaded dynamically

This commit is contained in:
Tom Wiesing 2023-11-08 10:29:09 +01:00
parent e49f89d4ee
commit 08ab7b4383
No known key found for this signature in database
22 changed files with 934 additions and 81 deletions

View file

@ -0,0 +1,32 @@
package actions
import (
"context"
"io"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/auth/scopes"
"github.com/FAU-CDI/wisski-distillery/internal/wisski"
)
type Update struct {
component.Base
}
var (
_ WebsocketInstanceAction = (*Update)(nil)
)
func (*Update) Action() InstanceAction {
return InstanceAction{
Action: Action{
Name: "update",
Scope: scopes.ScopeUserAdmin,
NumParams: 0,
},
}
}
func (u *Update) Act(ctx context.Context, instance *wisski.WissKI, in io.Reader, out io.Writer, params ...string) error {
return instance.Composer().Update(ctx, out)
}