Merge pull request 'Move permission check from ArtifactsDeleteView to the route' (#2464) from algernon/forgejo:gitea-port/artifact-deletion/refactor into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2464 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
commit
490b81a8ed
2 changed files with 1 additions and 6 deletions
|
@ -579,11 +579,6 @@ func ArtifactsView(ctx *context_module.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ArtifactsDeleteView(ctx *context_module.Context) {
|
func ArtifactsDeleteView(ctx *context_module.Context) {
|
||||||
if !ctx.Repo.CanWrite(unit.TypeActions) {
|
|
||||||
ctx.Error(http.StatusForbidden, "no permission")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
runIndex := ctx.ParamsInt64("run")
|
runIndex := ctx.ParamsInt64("run")
|
||||||
artifactName := ctx.Params("artifact_name")
|
artifactName := ctx.Params("artifact_name")
|
||||||
|
|
||||||
|
|
|
@ -1401,7 +1401,7 @@ func registerRoutes(m *web.Route) {
|
||||||
m.Post("/approve", reqRepoActionsWriter, actions.Approve)
|
m.Post("/approve", reqRepoActionsWriter, actions.Approve)
|
||||||
m.Post("/artifacts", actions.ArtifactsView)
|
m.Post("/artifacts", actions.ArtifactsView)
|
||||||
m.Get("/artifacts/{artifact_name}", actions.ArtifactsDownloadView)
|
m.Get("/artifacts/{artifact_name}", actions.ArtifactsDownloadView)
|
||||||
m.Delete("/artifacts/{artifact_name}", actions.ArtifactsDeleteView)
|
m.Delete("/artifacts/{artifact_name}", reqRepoActionsWriter, actions.ArtifactsDeleteView)
|
||||||
m.Post("/rerun", reqRepoActionsWriter, actions.Rerun)
|
m.Post("/rerun", reqRepoActionsWriter, actions.Rerun)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue