mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 03:18:24 +00:00 
			
		
		
		
	refactor: remove unnessary condition in reqSelfOrAdmin middleware
This commit is contained in:
		| @@ -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 |  | ||||||
| 			} |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user