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
+12 -13
View File
@@ -17,7 +17,6 @@ import (
"mstore/app/operator"
"mstore/app/router"
"mstore/pkg/term"
"mstore/pkg/auxid"
)
// HEAD /v2/<name>/blobs/<digest> 200 404
@@ -33,7 +32,7 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, uint64(operatorID), term.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -44,7 +43,7 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
res, code, err := hand.oper.BlobExists(ctx, params)
res, code, err := hand.oper.BlobExists(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("BlobExist error: %v", err)
}
@@ -73,7 +72,7 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, uint64(operatorID), term.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -83,7 +82,7 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
return
}
// Execution of the operation
res, code, err := hand.oper.PostUpload(rctx.Ctx, params)
res, code, err := hand.oper.PostUpload(rctx.Ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("PostUpload error: %v", err)
} else {
@@ -118,7 +117,7 @@ func (hand *Handler) PatchUpload(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, uint64(operatorID), term.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -129,7 +128,7 @@ func (hand *Handler) PatchUpload(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
res, code, err := hand.oper.PatchUpload(ctx, params)
res, code, err := hand.oper.PatchUpload(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("PatchUpload error: %v", err)
}
@@ -162,7 +161,7 @@ func (hand *Handler) PutUpload(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, uint64(operatorID), term.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -172,7 +171,7 @@ func (hand *Handler) PutUpload(rctx *router.Context) {
return
}
// Execution of the operation
res, code, err := hand.oper.PutUpload(rctx.Ctx, params)
res, code, err := hand.oper.PutUpload(rctx.Ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("PutUpload error: %v", err)
}
@@ -192,7 +191,7 @@ func (hand *Handler) GetBlob(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, uint64(operatorID), term.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightReadImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -203,7 +202,7 @@ func (hand *Handler) GetBlob(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
res, code, err := hand.oper.GetBlob(ctx, params)
res, code, err := hand.oper.GetBlob(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("GetBlob error: %v", err)
}
@@ -238,7 +237,7 @@ func (hand *Handler) DeleteBlob(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, uint64(operatorID), term.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, term.RightWriteImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -249,7 +248,7 @@ func (hand *Handler) DeleteBlob(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
_, code, err := hand.oper.DeleteBlob(ctx, params)
_, code, err := hand.oper.DeleteBlob(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("DeleteBlob error: %v", err)
}