added minimal image checker
This commit is contained in:
@@ -236,3 +236,28 @@ func (hand *Handler) ListManifests(rctx *router.Context) {
|
||||
|
||||
rctx.SendJSON(code, res.Repositories)
|
||||
}
|
||||
|
||||
func (hand *Handler) CheckImages(rctx *router.Context) {
|
||||
name, _ := rctx.GetSubpath("name")
|
||||
params := &imageoper.CheckImagesParams{
|
||||
Name: name,
|
||||
}
|
||||
// Rigth checking
|
||||
operatorID, _ := rctx.GetString(userTag)
|
||||
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightWriteImages, name)
|
||||
if err != nil {
|
||||
rctx.SetStatus(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
if !opEnable {
|
||||
rctx.SetStatus(http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
// Execution of the operation
|
||||
ctx := rctx.GetContext()
|
||||
res, code, err := hand.imop.CheckImages(ctx, params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("CheckImages error: %v", err)
|
||||
}
|
||||
rctx.SendJSON(code, res.Repositories)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user