Browse Source

api: fix panic if anonymous user request admin API

Add sign in check before check user account level
tags/v0.9.99
Unknwon 7 years ago
parent
commit
e63b2881b1
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      routers/api/v1/api.go

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

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

Loading…
Cancel
Save