Skip to content

Commit f3f6908

Browse files
committed
refactor: remove unnessary condition in reqSelfOrAdmin middleware
1 parent d41dc95 commit f3f6908

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

routers/api/v1/api.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -479,12 +479,11 @@ func reqOwner() func(ctx *context.APIContext) {
479479
// reqSelfOrAdmin doer should be the same as the contextUser or site admin
480480
func reqSelfOrAdmin() func(ctx *context.APIContext) {
481481
return func(ctx *context.APIContext) {
482-
if ctx.ContextUser.IsIndividual() {
483-
if !ctx.IsUserSiteAdmin() && ctx.ContextUser != ctx.Doer {
484-
ctx.Error(http.StatusForbidden, "reqSelfOrAdmin", "doer should be the site admin or be same as the contextUser")
485-
return
486-
}
482+
if !ctx.IsUserSiteAdmin() && ctx.ContextUser != ctx.Doer {
483+
ctx.Error(http.StatusForbidden, "reqSelfOrAdmin", "doer should be the site admin or be same as the contextUser")
484+
return
487485
}
486+
488487
}
489488
}
490489

0 commit comments

Comments
 (0)