瀏覽代碼

Tokens small fixes

Torkel Ödegaard 11 年之前
父節點
當前提交
aa9ca68883
共有 4 個文件被更改,包括 6 次插入5 次删除
  1. 1 1
      grafana
  2. 2 0
      pkg/api/api.go
  3. 3 3
      pkg/api/token.go
  4. 0 1
      pkg/models/account.go

+ 1 - 1
grafana

@@ -1 +1 @@
-Subproject commit d3cc6e518dfd2ceb26c0e568bc603b4473b11a02
+Subproject commit aaa717aac2c1f5e440d61cbe08e55357b4d2570b

+ 2 - 0
pkg/api/api.go

@@ -25,6 +25,8 @@ func Register(r *macaron.Macaron) {
 	// authed views
 	r.Get("/account/", reqSignedIn, Index)
 	r.Get("/account/datasources/", reqSignedIn, Index)
+	r.Get("/account/collaborators/", reqSignedIn, Index)
+	r.Get("/account/apikeys/", reqSignedIn, Index)
 	r.Get("/admin", reqSignedIn, Index)
 	r.Get("/dashboard/*", reqSignedIn, Index)
 

+ 3 - 3
pkg/api/token.go

@@ -8,7 +8,7 @@ import (
 )
 
 func GetTokens(c *middleware.Context) {
-	query := m.GetTokensQuery{AccountId: c.Account.Id}
+	query := m.GetTokensQuery{AccountId: c.UserAccount.Id}
 	err := bus.Dispatch(&query)
 
 	if err != nil {
@@ -47,7 +47,7 @@ func AddToken(c *middleware.Context, cmd m.AddTokenCommand) {
 		return
 	}
 
-	cmd.AccountId = c.Account.Id
+	cmd.AccountId = c.UserAccount.Id
 	cmd.Token = util.GetRandomString(64)
 
 	if err := bus.Dispatch(&cmd); err != nil {
@@ -71,7 +71,7 @@ func UpdateToken(c *middleware.Context, cmd m.UpdateTokenCommand) {
 		return
 	}
 
-	cmd.AccountId = c.Account.Id
+	cmd.AccountId = c.UserAccount.Id
 
 	err := bus.Dispatch(&cmd)
 	if err != nil {

+ 0 - 1
pkg/models/account.go

@@ -6,7 +6,6 @@ import (
 )
 
 // Typed errors
-
 var (
 	ErrAccountNotFound = errors.New("Account not found")
 )