Working on collaborators

This commit is contained in:
Torkel Ödegaard
2014-09-19 17:37:18 +02:00
parent 1705734435
commit a9a06ad51d
11 changed files with 174 additions and 98 deletions

View File

@ -7,6 +7,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/gorilla/sessions"
"github.com/torkelo/grafana-pro/pkg/components"
"github.com/torkelo/grafana-pro/pkg/models"
"github.com/torkelo/grafana-pro/pkg/stores"
)
@ -61,9 +62,9 @@ func (self *HttpServer) ListenAndServe() {
func (self *HttpServer) index(c *gin.Context) {
viewModel := &IndexDto{}
login, _ := c.Get("login")
if login != nil {
viewModel.User.Login = login.(string)
userAccount, _ := c.Get("userAccount")
if userAccount != nil {
viewModel.User.Login = userAccount.(*models.UserAccount).Login
}
c.HTML(200, "index.html", viewModel)
@ -74,12 +75,3 @@ func CacheHeadersMiddleware() gin.HandlerFunc {
c.Writer.Header().Add("Cache-Control", "max-age=0, public, must-revalidate, proxy-revalidate")
}
}
// Api Handler Registration
var routeHandlers = make([]routeHandlerRegisterFn, 0)
type routeHandlerRegisterFn func(self *HttpServer)
func addRoutes(fn routeHandlerRegisterFn) {
routeHandlers = append(routeHandlers, fn)
}