mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	api: fix panic if anonymous user request admin API
Add sign in check before check user account level
This commit is contained in:
		@@ -103,7 +103,7 @@ func ReqBasicAuth() macaron.Handler {
 | 
			
		||||
 | 
			
		||||
func ReqAdmin() macaron.Handler {
 | 
			
		||||
	return func(ctx *context.Context) {
 | 
			
		||||
		if !ctx.User.IsAdmin {
 | 
			
		||||
		if !ctx.IsSigned || !ctx.User.IsAdmin {
 | 
			
		||||
			ctx.Error(403)
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user