Snapshot: Fix http api (#18830)

(cherry picked from commit be2e2330f5)
This commit is contained in:
Marcus Efraimsson
2019-09-02 15:15:46 +02:00
committed by GitHub
parent 2672b92206
commit 964c2e722f
6 changed files with 47 additions and 7 deletions
+13
View File
@@ -103,3 +103,16 @@ func AdminOrFeatureEnabled(enabled bool) macaron.Handler {
}
}
}
func SnapshotPublicModeOrSignedIn() macaron.Handler {
return func(c *m.ReqContext) {
if setting.SnapshotPublicMode {
return
}
_, err := c.Invoke(ReqSignedIn)
if err != nil {
c.JsonApiErr(500, "Failed to invoke required signed in middleware", err)
}
}
}