uuid used

This commit is contained in:
2026-02-20 15:06:15 +02:00
parent 35e83ed705
commit 8546ad496f
31 changed files with 265 additions and 238 deletions
+7 -12
View File
@@ -17,6 +17,7 @@ import (
"mstore/app/router"
"mstore/pkg/auxhttp"
"mstore/pkg/auxpwd"
"mstore/pkg/auxuuid"
"mstore/pkg/terms"
)
@@ -29,40 +30,35 @@ func (hand *Handler) AuthMiddleware(next router.Handler) router.Handler {
var handlerFunc router.HandlerFunc
handlerFunc = func(rctx *router.Context) {
//hand.logg.Debugf("Call authorization middleware")
success, accountID, err := hand.CheckAccess(rctx)
if success {
rctx.SetBool(authTag, true)
rctx.SetString(userTag, accountID)
//hand.logg.Debugf("Authorization for accountID [%s]", rctx.Strings[userTag])
rctx.SetString(userTag, string(accountID))
}
if err != nil {
hand.logg.Errorf("Authorization middleware error: %v", err)
}
next.ServeHTTP(rctx)
}
return handlerFunc
}
// Authentification
func (hand *Handler) CheckAccess(rctx *router.Context) (bool, string, error) {
func (hand *Handler) CheckAccess(rctx *router.Context) (bool, auxuuid.UUID, error) {
var err error
var success bool
var username string
var password string
var accountID string
var accountID auxuuid.UUID
accountID = terms.AnonymousID
authHeader := rctx.GetHeader("Authorization")
if authHeader != "" {
//hand.logg.Debugf("Authorization header is %s", authHeader)
username, password, err = auxhttp.ParseBasicAuth(authHeader)
if err != nil {
return success, accountID, err
}
//hand.logg.Debugf("Authorization pair is %s:%s", username, password)
if username == "" || password == "" {
goto anonymous
}
@@ -84,9 +80,9 @@ anonymous:
return success, accountID, err
}
func (hand *Handler) ValidatePassword(ctx context.Context, username, password string) (bool, string, error) {
func (hand *Handler) ValidatePassword(ctx context.Context, username, password string) (bool, auxuuid.UUID, error) {
var err error
var accountID string
var accountID auxuuid.UUID
valid := false
accountExists, accountDescr, err := hand.mdb.GetAccountByUsername(ctx, username)
@@ -106,7 +102,7 @@ func (hand *Handler) ValidatePassword(ctx context.Context, username, password st
// Authorization
func (hand *Handler) CheckRight(ctx context.Context, accountID, reqRight, subject string) (bool, error) {
func (hand *Handler) CheckRight(ctx context.Context, accountID auxuuid.UUID, reqRight, subject string) (bool, error) {
var err error
var res bool
//hand.logg.Debugf("Cop check your right %s: %s %s", accountID, reqRight, subject)
@@ -142,6 +138,5 @@ func (hand *Handler) CheckRight(ctx context.Context, accountID, reqRight, subjec
// NOP
}
res = true
//hand.logg.Debugf("Result of checking right %s for %s: %v", reqRight, accountID, res)
return res, err
}
+10 -9
View File
@@ -14,6 +14,7 @@ import (
"mstore/app/operator"
"mstore/app/router"
"mstore/pkg/auxuuid"
"mstore/pkg/terms"
)
@@ -29,7 +30,7 @@ func (hand *Handler) CreateAccount(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -41,7 +42,7 @@ func (hand *Handler) CreateAccount(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.CreateAccount(rctx.Ctx, operatorID, params)
res, err := hand.oper.CreateAccount(rctx.Ctx, auxuuid.UUID(operatorID), params)
if err != nil {
hand.logg.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -62,7 +63,7 @@ func (hand *Handler) GetAccount(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -74,7 +75,7 @@ func (hand *Handler) GetAccount(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.GetAccount(rctx.Ctx, params)
res, err := hand.oper.GetAccount(rctx.Ctx, auxuuid.UUID(operatorID), params)
if err != nil {
hand.logg.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -95,7 +96,7 @@ func (hand *Handler) ListAccounts(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -128,7 +129,7 @@ func (hand *Handler) UpdateAccount(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -140,7 +141,7 @@ func (hand *Handler) UpdateAccount(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.UpdateAccount(rctx.Ctx, params)
res, err := hand.oper.UpdateAccount(rctx.Ctx, auxuuid.UUID(operatorID), params)
if err != nil {
hand.logg.Errorf("UpdateAccount error: %v", err)
hand.SendError(rctx, err)
@@ -161,7 +162,7 @@ func (hand *Handler) DeleteAccount(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, params.Username)
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteAccounts, params.Username)
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -173,7 +174,7 @@ func (hand *Handler) DeleteAccount(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.DeleteAccount(rctx.Ctx, params)
res, err := hand.oper.DeleteAccount(rctx.Ctx, auxuuid.UUID(operatorID), params)
if err != nil {
hand.logg.Errorf("DeleteAccount error: %v", err)
hand.SendError(rctx, err)
+8 -7
View File
@@ -16,6 +16,7 @@ import (
"mstore/app/operator"
"mstore/app/router"
"mstore/pkg/auxuuid"
"mstore/pkg/terms"
)
@@ -32,7 +33,7 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -72,7 +73,7 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -88,7 +89,7 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
} else {
rctx.SetHeader("Location", res.Location)
rctx.SetHeader("Content-Length", res.ContentLength)
rctx.SetHeader("Docker-Upload-UUID", res.DockerUploadUUID)
rctx.SetHeader("Docker-Upload-UUID", string(res.DockerUploadUUID))
}
rctx.SetStatus(code)
}
@@ -117,7 +118,7 @@ func (hand *Handler) PatchUpload(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -161,7 +162,7 @@ func (hand *Handler) PutUpload(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -191,7 +192,7 @@ func (hand *Handler) GetBlob(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -237,7 +238,7 @@ func (hand *Handler) DeleteBlob(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
+19 -18
View File
@@ -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)
+11 -10
View File
@@ -14,6 +14,7 @@ import (
"mstore/app/operator"
"mstore/app/router"
"mstore/pkg/auxuuid"
"mstore/pkg/terms"
)
@@ -29,7 +30,7 @@ func (hand *Handler) CreateGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -41,7 +42,7 @@ func (hand *Handler) CreateGrant(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.CreateGrant(rctx.Ctx, operatorID, params)
res, err := hand.oper.CreateGrant(rctx.Ctx, auxuuid.UUID(operatorID), params)
if err != nil {
hand.logg.Errorf("CreateGrant error: %v", err)
hand.SendError(rctx, err)
@@ -62,7 +63,7 @@ func (hand *Handler) GetGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -74,7 +75,7 @@ func (hand *Handler) GetGrant(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.GetGrant(rctx.Ctx, operatorID, params)
res, err := hand.oper.GetGrant(rctx.Ctx, auxuuid.UUID(operatorID), params)
if err != nil {
hand.logg.Errorf("CreateGrant error: %v", err)
hand.SendError(rctx, err)
@@ -95,7 +96,7 @@ func (hand *Handler) ListGrants(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -107,7 +108,7 @@ func (hand *Handler) ListGrants(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.ListGrants(rctx.Ctx, operatorID, params)
res, err := hand.oper.ListGrants(rctx.Ctx, auxuuid.UUID(operatorID), params)
if err != nil {
hand.logg.Errorf("ListGrants error: %v", err)
hand.SendError(rctx, err)
@@ -128,7 +129,7 @@ func (hand *Handler) UpdateGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -140,7 +141,7 @@ func (hand *Handler) UpdateGrant(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.UpdateGrant(rctx.Ctx, operatorID, params)
res, err := hand.oper.UpdateGrant(rctx.Ctx, auxuuid.UUID(operatorID), params)
if err != nil {
hand.logg.Errorf("UpdateGrant error: %v", err)
hand.SendError(rctx, err)
@@ -161,7 +162,7 @@ func (hand *Handler) DeleteGrant(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteAccounts, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteAccounts, "")
if err != nil {
err := fmt.Errorf("Operation error: %v", err)
hand.SendError(rctx, err)
@@ -173,7 +174,7 @@ func (hand *Handler) DeleteGrant(rctx *router.Context) {
return
}
// Execution of the operation
res, err := hand.oper.DeleteGrant(rctx.Ctx, operatorID, params)
res, err := hand.oper.DeleteGrant(rctx.Ctx, auxuuid.UUID(operatorID), params)
if err != nil {
hand.logg.Errorf("DeleteGrant error: %v", err)
hand.SendError(rctx, err)
+7 -6
View File
@@ -14,6 +14,7 @@ import (
"mstore/app/operator"
"mstore/app/router"
"mstore/pkg/auxuuid"
"mstore/pkg/terms"
)
@@ -29,7 +30,7 @@ func (hand *Handler) ManifestExists(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -71,7 +72,7 @@ func (hand *Handler) PutManifest(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -104,7 +105,7 @@ func (hand *Handler) GetManifest(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -144,7 +145,7 @@ func (hand *Handler) DeleteManifest(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightWriteImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -173,7 +174,7 @@ func (hand *Handler) GetReferer(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return
@@ -199,7 +200,7 @@ func (hand *Handler) GetTags(rctx *router.Context) {
}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, "")
opEnable, err := hand.CheckRight(rctx.Ctx, auxuuid.UUID(operatorID), terms.RightReadImages, "")
if err != nil {
rctx.SetStatus(http.StatusInternalServerError)
return