working commit

This commit is contained in:
2026-02-21 12:31:39 +02:00
parent 3220e2d78f
commit cd37a4508c
37 changed files with 354 additions and 319 deletions
+10 -11
View File
@@ -15,7 +15,6 @@ import (
"mstore/app/operator"
"mstore/app/router"
"mstore/pkg/term"
"mstore/pkg/auxid"
)
// POST /v3/grant/create 200 200
@@ -30,7 +29,7 @@ func (hand *Handler) CreateGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, uint64(operatorID), term.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -42,7 +41,7 @@ func (hand *Handler) CreateGrant(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.CreateGrant(rctx.Ctx, uint64(operatorID), params)
res, err := hand.oper.CreateGrant(rctx.Ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("CreateGrant error: %v", err)
hand.SendError(rctx, err)
@@ -63,7 +62,7 @@ func (hand *Handler) GetGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, uint64(operatorID), term.RightReadAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -75,7 +74,7 @@ func (hand *Handler) GetGrant(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.GetGrant(rctx.Ctx, uint64(operatorID), params)
res, err := hand.oper.GetGrant(rctx.Ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("CreateGrant error: %v", err)
hand.SendError(rctx, err)
@@ -96,7 +95,7 @@ func (hand *Handler) ListGrants(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, uint64(operatorID), term.RightReadAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -108,7 +107,7 @@ func (hand *Handler) ListGrants(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.ListGrants(rctx.Ctx, uint64(operatorID), params)
res, err := hand.oper.ListGrants(rctx.Ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("ListGrants error: %v", err)
hand.SendError(rctx, err)
@@ -129,7 +128,7 @@ func (hand *Handler) UpdateGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, uint64(operatorID), term.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -141,7 +140,7 @@ func (hand *Handler) UpdateGrant(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.UpdateGrant(rctx.Ctx, uint64(operatorID), params)
res, err := hand.oper.UpdateGrant(rctx.Ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("UpdateGrant error: %v", err)
hand.SendError(rctx, err)
@@ -162,7 +161,7 @@ func (hand *Handler) DeleteGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, uint64(operatorID), term.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -174,7 +173,7 @@ func (hand *Handler) DeleteGrant(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.DeleteGrant(rctx.Ctx, uint64(operatorID), params)
res, err := hand.oper.DeleteGrant(rctx.Ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("DeleteGrant error: %v", err)
hand.SendError(rctx, err)