Forráskód Böngészése

fix(auth proxy): Fix for server side rendering of panel when using auth proxy, fixes #2568

Torkel Ödegaard 10 éve
szülő
commit
7072af7c14
3 módosított fájl, 11 hozzáadás és 1 törlés
  1. 1 1
      .bra.toml
  2. 1 0
      CHANGELOG.md
  3. 9 0
      pkg/middleware/auth_proxy.go

+ 1 - 1
.bra.toml

@@ -9,7 +9,7 @@ watch_dirs = [
 	"$WORKDIR/public/views",
 	"$WORKDIR/conf",
 ]
-watch_exts = [".go", "conf/*"]
+watch_exts = [".go", ".ini", ".toml"]
 build_delay = 1500
 cmds = [
   ["go", "build", "-o", "./bin/grafana-server"],

+ 1 - 0
CHANGELOG.md

@@ -10,6 +10,7 @@ it allows you to add queries of differnet data source types & instances to the s
 - [Issue #1186](https://github.com/grafana/grafana/issues/1186). Time Picker: New option `today`, will set time range from midnight to now
 
 **Fixes**
+- [Issue #2568](https://github.com/grafana/grafana/issues/2568). AuthProxy: Fix for server side rendering of panel when using auth proxy
 - [Issue #2490](https://github.com/grafana/grafana/issues/2490). Graphite: Dashboard import was broken in 2.1 and 2.1.1, working now
 - [Issue #2565](https://github.com/grafana/grafana/issues/2565). TimePicker: Fix for when you applied custom time range it did not refreh dashboard
 

+ 9 - 0
pkg/middleware/auth_proxy.go

@@ -2,6 +2,7 @@ package middleware
 
 import (
 	"github.com/grafana/grafana/pkg/bus"
+	"github.com/grafana/grafana/pkg/log"
 	m "github.com/grafana/grafana/pkg/models"
 	"github.com/grafana/grafana/pkg/setting"
 )
@@ -39,8 +40,16 @@ func initContextWithAuthProxy(ctx *Context) bool {
 		}
 	}
 
+	// initialize session
+	if err := ctx.Session.Start(ctx); err != nil {
+		log.Error(3, "Failed to start session", err)
+		return false
+	}
+
 	ctx.SignedInUser = query.Result
 	ctx.IsSignedIn = true
+	ctx.Session.Set(SESS_KEY_USERID, ctx.UserId)
+
 	return true
 }