working commit

This commit is contained in:
2026-02-12 17:52:05 +02:00
parent fbbb09a3cb
commit c2d231c844
6 changed files with 63 additions and 50 deletions
+24 -2
View File
@@ -1,19 +1,41 @@
package handler
import (
"context"
"fmt"
"mstore/app/descr"
"mstore/app/operator"
"mstore/app/router"
)
func (hand *Handler) CheckGrant(ctx context.Context, accountID, grant, subject string) (bool, error) {
var err error
var res bool
return res, err
}
// POST /v3/account/create 200 200
func (hand *Handler) CreateAccount(rctx *router.Context) {
var err error
operatorID := descr.AnonymousID
params := &operator.CreateAccountParams{}
err = rctx.BindJSON(params)
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckGrant(rctx.Ctx, operatorID, descr.GrantCreateAccount, params.Username)
if err != nil {
err := fmt.Errorf("CreateAccount error: %v", err)
hand.SendError(rctx, err)
return
}
if !opEnable {
err := fmt.Errorf("CreateAccount not enabled for this user")
hand.SendError(rctx, err)
return
}
if err != nil {
hand.SendError(rctx, err)
return