working commit

This commit is contained in:
2026-06-07 18:19:15 +02:00
parent d3556d397c
commit 0506b35cd1
26 changed files with 199 additions and 1299 deletions
+5 -5
View File
@@ -23,7 +23,7 @@ func (hand *Handler) Authentificate(ctx context.Context) (string, error) {
}
username := meta["username"][0]
password := meta["password"][0]
validated, accountID, err := hand.lg.ValidateAccount(ctx, username, password)
validated, accountID, err := hand.oper.ValidateAccount(ctx, username, password)
if !validated {
err := status.Errorf(codes.PermissionDenied, "Wrong auth data")
return accountID, err
@@ -39,7 +39,7 @@ func (hand *Handler) CreateAccount(ctx context.Context, params *mbctl.CreateAcco
if err != nil {
return res, err
}
res, err = hand.lg.CreateAccount(ctx, accountID, params)
res, err = hand.oper.CreateAccount(ctx, accountID, params)
return res, err
}
@@ -51,7 +51,7 @@ func (hand *Handler) DeleteAccount(ctx context.Context, params *mbctl.DeleteAcco
if err != nil {
return res, err
}
res, err = hand.lg.DeleteAccount(ctx, accountID, params)
res, err = hand.oper.DeleteAccount(ctx, accountID, params)
return res, err
}
@@ -63,7 +63,7 @@ func (hand *Handler) ListAccounts(ctx context.Context, params *mbctl.ListAccount
if err != nil {
return res, err
}
res, err = hand.lg.ListAccounts(ctx, accountID, params)
res, err = hand.oper.ListAccounts(ctx, accountID, params)
return res, err
}
@@ -75,6 +75,6 @@ func (hand *Handler) UpdateAccount(ctx context.Context, params *mbctl.UpdateAcco
if err != nil {
return res, err
}
res, err = hand.lg.UpdateAccount(ctx, accountID, params)
res, err = hand.oper.UpdateAccount(ctx, accountID, params)
return res, err
}
+2 -2
View File
@@ -14,7 +14,7 @@ func (hand *Handler) GetDump(ctx context.Context, params *mbctl.GetDumpParams) (
if err != nil {
return res, err
}
res, err = hand.lg.GetDump(ctx, accountID, params)
res, err = hand.oper.GetDump(ctx, accountID, params)
return res, err
}
@@ -26,6 +26,6 @@ func (hand *Handler) RestoreDump(ctx context.Context, params *mbctl.RestoreDumpP
if err != nil {
return res, err
}
res, err = hand.lg.RestoreDump(ctx, accountID, params)
res, err = hand.oper.RestoreDump(ctx, accountID, params)
return res, err
}
+2 -2
View File
@@ -14,7 +14,7 @@ func (hand *Handler) SetGrant(ctx context.Context, params *mbctl.SetGrantParams)
if err != nil {
return res, err
}
res, err = hand.lg.SetGrant(ctx, accountID, params)
res, err = hand.oper.SetGrant(ctx, accountID, params)
return res, err
}
@@ -26,6 +26,6 @@ func (hand *Handler) DeleteGrant(ctx context.Context, params *mbctl.DeleteGrantP
if err != nil {
return res, err
}
res, err = hand.lg.DeleteGrant(ctx, accountID, params)
res, err = hand.oper.DeleteGrant(ctx, accountID, params)
return res, err
}
+4 -4
View File
@@ -9,18 +9,18 @@ import (
)
type HandlerConfig struct {
Logic *operator.Logic
Operator *operator.Operator
}
type Handler struct {
mbctl.UnimplementedControlServer
lg *operator.Logic
log *logger.Logger
oper *operator.Operator
log *logger.Logger
}
func NewHandler(conf *HandlerConfig) *Handler {
hand := Handler{
lg: conf.Logic,
oper: conf.Operator,
}
hand.log = logger.NewLogger("ghandler")
return &hand
+1 -1
View File
@@ -9,6 +9,6 @@ import (
func (hand *Handler) GetHello(ctx context.Context, params *mbctl.GetHelloParams) (*mbctl.GetHelloResult, error) {
var err error
hand.log.Debugf("Handle getHello call")
res, err := hand.lg.GetHello(ctx, params)
res, err := hand.oper.GetHello(ctx, params)
return res, err
}