瀏覽代碼

Accounts admin view/get api

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

+ 1 - 1
grafana

@@ -1 +1 @@
-Subproject commit cf344abff2cdf7638d1748aa698caf23c3848715
+Subproject commit 5b93e09714dbee6c1c181daf0182704334d8c6be

+ 1 - 1
pkg/api/api.go

@@ -10,7 +10,7 @@ import (
 // Register adds http routes
 func Register(m *macaron.Macaron) {
 	reqSignedIn := middleware.Auth(&middleware.AuthOptions{ReqSignedIn: true})
-	reqAdmin := middleware.Auth(&middleware.AuthOptions{ReqSignedIn: true, ReqAdmin: false})
+	reqAdmin := middleware.Auth(&middleware.AuthOptions{ReqSignedIn: true, ReqAdmin: true})
 
 	// not logged in views
 	m.Get("/", reqSignedIn, Index)

+ 5 - 3
pkg/models/account.go

@@ -95,9 +95,11 @@ type CollaboratorDTO struct {
 }
 
 type AccountSearchHitDTO struct {
-	Id    int64  `json:"id"`
-	Name  string `json:"name"`
-	Email string `json:"email"`
+	Id      int64  `json:"id"`
+	Name    string `json:"name"`
+	Login   string `json:"login"`
+	Email   string `json:"email"`
+	IsAdmin bool   `json:"isAdmin"`
 }
 
 type AccountDTO struct {

+ 1 - 1
pkg/services/sqlstore/accounts.go

@@ -188,7 +188,7 @@ func SearchAccounts(query *m.SearchAccountsQuery) error {
 	sess := x.Table("account")
 	sess.Where("email LIKE ?", query.Query+"%")
 	sess.Limit(query.Limit, query.Limit*query.Page)
-	sess.Cols("id", "email", "name")
+	sess.Cols("id", "email", "name", "login", "is_admin")
 	err := sess.Find(&query.Result)
 	return err