working commit
This commit is contained in:
+12
-25
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user