uuid used
This commit is contained in:
+19
-18
@@ -15,6 +15,7 @@ import (
|
||||
|
||||
"mstore/app/operator"
|
||||
"mstore/app/router"
|
||||
"mstore/pkg/auxuuid"
|
||||
"mstore/pkg/terms"
|
||||
)
|
||||
|
||||
@@ -28,7 +29,7 @@ func (hand *Handler) FileInfo(rctx *router.Context) {
|
||||
}
|
||||
// Rigth checking
|
||||
operatorID, _ := rctx.GetString(userTag)
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadFiles, "")
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadFiles, "")
|
||||
if err != nil {
|
||||
rctx.SetStatus(http.StatusInternalServerError)
|
||||
return
|
||||
@@ -39,7 +40,7 @@ func (hand *Handler) FileInfo(rctx *router.Context) {
|
||||
}
|
||||
// Execution of the operation
|
||||
ctx := rctx.GetContext()
|
||||
code, res, err := hand.oper.FileInfo(ctx, operatorID, params)
|
||||
code, res, err := hand.oper.FileInfo(ctx, auxuuid.UUID(operatorID), params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("FileInfo error: %v", err)
|
||||
rctx.SetStatus(code)
|
||||
@@ -52,9 +53,9 @@ func (hand *Handler) FileInfo(rctx *router.Context) {
|
||||
rctx.SetHeader("Content-Digest", res.ContentDigest)
|
||||
|
||||
rctx.SetHeader("Content-CreatedAt", res.ContentCreatedAt)
|
||||
rctx.SetHeader("Content-CreatedBy", res.ContentCreatedBy)
|
||||
rctx.SetHeader("Content-CreatedBy", string(res.ContentCreatedBy))
|
||||
rctx.SetHeader("Content-UpdatedAt", res.ContentUpdatedAt)
|
||||
rctx.SetHeader("Content-UpdatedBy", res.ContentUpdatedBy)
|
||||
rctx.SetHeader("Content-UpdatedBy", string(res.ContentUpdatedBy))
|
||||
|
||||
rctx.SetHeader("Content-Length", zeroContentLength)
|
||||
rctx.SetStatus(code)
|
||||
@@ -73,7 +74,7 @@ func (hand *Handler) PutFile(rctx *router.Context) {
|
||||
}
|
||||
// Rigth checking
|
||||
operatorID, _ := rctx.GetString(userTag)
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteFiles, "")
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteFiles, "")
|
||||
if err != nil {
|
||||
rctx.SetStatus(http.StatusInternalServerError)
|
||||
return
|
||||
@@ -84,7 +85,7 @@ func (hand *Handler) PutFile(rctx *router.Context) {
|
||||
}
|
||||
// Execution of the operation
|
||||
ctx := rctx.GetContext()
|
||||
code, _, err := hand.oper.PutFile(ctx, operatorID, params)
|
||||
code, _, err := hand.oper.PutFile(ctx, auxuuid.UUID(operatorID), params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("PutFile error: %v", err)
|
||||
rctx.SetStatus(code)
|
||||
@@ -101,7 +102,7 @@ func (hand *Handler) GetFile(rctx *router.Context) {
|
||||
}
|
||||
// Rigth checking
|
||||
operatorID, _ := rctx.GetString(userTag)
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadFiles, "")
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadFiles, "")
|
||||
if err != nil {
|
||||
rctx.SetStatus(http.StatusInternalServerError)
|
||||
return
|
||||
@@ -112,7 +113,7 @@ func (hand *Handler) GetFile(rctx *router.Context) {
|
||||
}
|
||||
// Execution of the operation
|
||||
ctx := rctx.GetContext()
|
||||
code, res, err := hand.oper.GetFile(ctx, operatorID, params)
|
||||
code, res, err := hand.oper.GetFile(ctx, auxuuid.UUID(operatorID), params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("PutFile error: %v", err)
|
||||
rctx.SetStatus(code)
|
||||
@@ -125,9 +126,9 @@ func (hand *Handler) GetFile(rctx *router.Context) {
|
||||
rctx.SetHeader("Content-Length", res.ContentSize)
|
||||
|
||||
rctx.SetHeader("Content-CreatedAt", res.ContentCreatedAt)
|
||||
rctx.SetHeader("Content-CreatedBy", res.ContentCreatedBy)
|
||||
rctx.SetHeader("Content-CreatedBy", string(res.ContentCreatedBy))
|
||||
rctx.SetHeader("Content-UpdatedAt", res.ContentUpdatedAt)
|
||||
rctx.SetHeader("Content-UpdatedBy", res.ContentUpdatedBy)
|
||||
rctx.SetHeader("Content-UpdatedBy", string(res.ContentUpdatedBy))
|
||||
|
||||
rctx.SetStatus(code)
|
||||
|
||||
@@ -149,7 +150,7 @@ func (hand *Handler) DeleteFile(rctx *router.Context) {
|
||||
}
|
||||
// Rigth checking
|
||||
operatorID, _ := rctx.GetString(userTag)
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteFiles, "")
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteFiles, "")
|
||||
if err != nil {
|
||||
rctx.SetStatus(http.StatusInternalServerError)
|
||||
return
|
||||
@@ -160,7 +161,7 @@ func (hand *Handler) DeleteFile(rctx *router.Context) {
|
||||
}
|
||||
// Execution of the operation
|
||||
ctx := rctx.GetContext()
|
||||
code, _, err := hand.oper.DeleteFile(ctx, operatorID, params)
|
||||
code, _, err := hand.oper.DeleteFile(ctx, auxuuid.UUID(operatorID), params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("DeleteFIle error: %v", err)
|
||||
}
|
||||
@@ -186,7 +187,7 @@ func (hand *Handler) ListFiles(rctx *router.Context) {
|
||||
|
||||
// Rigth checking
|
||||
operatorID, _ := rctx.GetString(userTag)
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadFiles, "")
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadFiles, "")
|
||||
if err != nil {
|
||||
rctx.SetStatus(http.StatusInternalServerError)
|
||||
return
|
||||
@@ -197,7 +198,7 @@ func (hand *Handler) ListFiles(rctx *router.Context) {
|
||||
}
|
||||
// Execution of the operation
|
||||
ctx := rctx.GetContext()
|
||||
code, res, err := hand.oper.ListFiles(ctx, operatorID, params)
|
||||
code, res, err := hand.oper.ListFiles(ctx, auxuuid.UUID(operatorID), params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("ListFiles error: %v", err)
|
||||
rctx.SetStatus(code)
|
||||
@@ -223,7 +224,7 @@ func (hand *Handler) ListCollections(rctx *router.Context) {
|
||||
}
|
||||
// Rigth checking
|
||||
operatorID, _ := rctx.GetString(userTag)
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadFiles, "")
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadFiles, "")
|
||||
if err != nil {
|
||||
rctx.SetStatus(http.StatusInternalServerError)
|
||||
return
|
||||
@@ -234,7 +235,7 @@ func (hand *Handler) ListCollections(rctx *router.Context) {
|
||||
}
|
||||
// Execution of the operation
|
||||
ctx := rctx.GetContext()
|
||||
code, res, err := hand.oper.ListCollections(ctx, operatorID, params)
|
||||
code, res, err := hand.oper.ListCollections(ctx, auxuuid.UUID(operatorID), params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("ListCollections error: %v", err)
|
||||
rctx.SetStatus(code)
|
||||
@@ -261,7 +262,7 @@ func (hand *Handler) DeleteCollection(rctx *router.Context) {
|
||||
|
||||
// Rigth checking
|
||||
operatorID, _ := rctx.GetString(userTag)
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadFiles, "")
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadFiles, "")
|
||||
if err != nil {
|
||||
rctx.SetStatus(http.StatusInternalServerError)
|
||||
return
|
||||
@@ -272,7 +273,7 @@ func (hand *Handler) DeleteCollection(rctx *router.Context) {
|
||||
}
|
||||
// Execution of the operation
|
||||
ctx := rctx.GetContext()
|
||||
code, res, err := hand.oper.DeleteColletion(ctx, operatorID, params)
|
||||
code, res, err := hand.oper.DeleteColletion(ctx, auxuuid.UUID(operatorID), params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("DeleteColletion error: %v", err)
|
||||
rctx.SetStatus(code)
|
||||
|
||||
Reference in New Issue
Block a user