mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-11 06:34:39 +01:00
Remove redundant Repo.CanWrite checks from action handlers - permissions are enforced at route level
This commit is contained in:
parent
31cb3617a3
commit
0657d25583
@ -107,11 +107,6 @@ func RerunWorkflowRun(ctx *context.APIContext) {
|
|||||||
// "404":
|
// "404":
|
||||||
// "$ref": "#/responses/notFound"
|
// "$ref": "#/responses/notFound"
|
||||||
|
|
||||||
if !ctx.Repo.CanWrite(unit.TypeActions) {
|
|
||||||
ctx.APIError(403, "User does not have write access to actions")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
_, run, err := getRunID(ctx)
|
_, run, err := getRunID(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, util.ErrNotExist) {
|
if errors.Is(err, util.ErrNotExist) {
|
||||||
@ -192,11 +187,6 @@ func CancelWorkflowRun(ctx *context.APIContext) {
|
|||||||
// "404":
|
// "404":
|
||||||
// "$ref": "#/responses/notFound"
|
// "$ref": "#/responses/notFound"
|
||||||
|
|
||||||
if !ctx.Repo.CanWrite(unit.TypeActions) {
|
|
||||||
ctx.APIError(403, "User does not have write access to actions")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
runID, _, err := getRunID(ctx)
|
runID, _, err := getRunID(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, util.ErrNotExist) {
|
if errors.Is(err, util.ErrNotExist) {
|
||||||
@ -293,11 +283,6 @@ func ApproveWorkflowRun(ctx *context.APIContext) {
|
|||||||
// "404":
|
// "404":
|
||||||
// "$ref": "#/responses/notFound"
|
// "$ref": "#/responses/notFound"
|
||||||
|
|
||||||
if !ctx.Repo.CanWrite(unit.TypeActions) {
|
|
||||||
ctx.APIError(403, "User does not have write access to actions")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
runID, _, err := getRunID(ctx)
|
runID, _, err := getRunID(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, util.ErrNotExist) {
|
if errors.Is(err, util.ErrNotExist) {
|
||||||
@ -396,11 +381,6 @@ func RerunWorkflowJob(ctx *context.APIContext) {
|
|||||||
// "404":
|
// "404":
|
||||||
// "$ref": "#/responses/notFound"
|
// "$ref": "#/responses/notFound"
|
||||||
|
|
||||||
if !ctx.Repo.CanWrite(unit.TypeActions) {
|
|
||||||
ctx.APIError(403, "User does not have write access to actions")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
runID, _, err := getRunID(ctx)
|
runID, _, err := getRunID(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, util.ErrNotExist) {
|
if errors.Is(err, util.ErrNotExist) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user