working commit

This commit is contained in:
2026-02-14 18:45:11 +02:00
parent 8d46c6a677
commit 53ed35dc08
16 changed files with 144 additions and 120 deletions
+12 -25
View File
@@ -11,7 +11,6 @@
package handler
import (
"fmt"
"io"
"net/http"
@@ -35,13 +34,11 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, descr.RightReadImages, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusInternalServerError)
return
}
if !opEnable {
err := fmt.Errorf("Operation not enabled for this account")
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusMethodNotAllowed)
return
}
// Execution of the operation
@@ -77,13 +74,11 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, descr.RightWriteImages, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusInternalServerError)
return
}
if !opEnable {
err := fmt.Errorf("Operation not enabled for this account")
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusMethodNotAllowed)
return
}
// Execution of the operation
@@ -124,13 +119,11 @@ func (hand *Handler) PatchUpload(rctx *router.Context) {
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, descr.RightWriteImages, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusInternalServerError)
return
}
if !opEnable {
err := fmt.Errorf("Operation not enabled for this account")
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusMethodNotAllowed)
return
}
// Execution of the operation
@@ -170,13 +163,11 @@ func (hand *Handler) PutUpload(rctx *router.Context) {
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, descr.RightWriteImages, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusInternalServerError)
return
}
if !opEnable {
err := fmt.Errorf("Operation not enabled for this account")
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusMethodNotAllowed)
return
}
// Execution of the operation
@@ -202,13 +193,11 @@ func (hand *Handler) GetBlob(rctx *router.Context) {
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, descr.RightReadImages, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusInternalServerError)
return
}
if !opEnable {
err := fmt.Errorf("Operation not enabled for this account")
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusMethodNotAllowed)
return
}
// Execution of the operation
@@ -250,13 +239,11 @@ func (hand *Handler) DeleteBlob(rctx *router.Context) {
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, descr.RightWriteImages, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusInternalServerError)
return
}
if !opEnable {
err := fmt.Errorf("Operation not enabled for this account")
hand.SendError(rctx, err)
rctx.SetStatus(http.StatusMethodNotAllowed)
return
}
// Execution of the operation