소스 검색

api: fix panic if anonymous user request admin API

Add sign in check before check user account level
Unknwon 8 년 전
부모
커밋
e63b2881b1
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      routers/api/v1/api.go

+ 1 - 1
routers/api/v1/api.go

@@ -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
 		}