Merge pull request #6378 from cd1989/retag-status-code-fix

Fix status code for permission check in retag, use 403
This commit is contained in:
Daniel Jiang 2018-11-29 16:00:34 +08:00 committed by GitHub
commit a3f424f5f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -479,14 +479,14 @@ func (ra *RepositoryAPI) Retag() {
// Check whether use has read permission to source project
if !ra.SecurityCtx.HasReadPerm(srcImage.Project) {
log.Errorf("user has no read permission to project '%s'", srcImage.Project)
ra.HandleUnauthorized()
ra.HandleForbidden(ra.SecurityCtx.GetUsername())
return
}
// Check whether user has write permission to target project
if !ra.SecurityCtx.HasWritePerm(project) {
log.Errorf("user has no write permission to project '%s'", project)
ra.HandleUnauthorized()
ra.HandleForbidden(ra.SecurityCtx.GetUsername())
return
}