mirror of
https://github.com/go-gitea/gitea
synced 2025-01-10 09:44:43 +00:00
refactor: remove unnessary condition in reqSelfOrAdmin middleware
This commit is contained in:
parent
d41dc95f10
commit
f3f69085d9
@ -479,12 +479,11 @@ func reqOwner() func(ctx *context.APIContext) {
|
|||||||
// reqSelfOrAdmin doer should be the same as the contextUser or site admin
|
// reqSelfOrAdmin doer should be the same as the contextUser or site admin
|
||||||
func reqSelfOrAdmin() func(ctx *context.APIContext) {
|
func reqSelfOrAdmin() func(ctx *context.APIContext) {
|
||||||
return func(ctx *context.APIContext) {
|
return func(ctx *context.APIContext) {
|
||||||
if ctx.ContextUser.IsIndividual() {
|
|
||||||
if !ctx.IsUserSiteAdmin() && ctx.ContextUser != ctx.Doer {
|
if !ctx.IsUserSiteAdmin() && ctx.ContextUser != ctx.Doer {
|
||||||
ctx.Error(http.StatusForbidden, "reqSelfOrAdmin", "doer should be the site admin or be same as the contextUser")
|
ctx.Error(http.StatusForbidden, "reqSelfOrAdmin", "doer should be the site admin or be same as the contextUser")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user