Commit 804bff55 by Torkel Ödegaard

Accounts admin view/get api

parent fdfcc3ab
Subproject commit cf344abff2cdf7638d1748aa698caf23c3848715
Subproject commit 5b93e09714dbee6c1c181daf0182704334d8c6be
......@@ -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)
......
......@@ -97,7 +97,9 @@ type CollaboratorDTO struct {
type AccountSearchHitDTO struct {
Id int64 `json:"id"`
Name string `json:"name"`
Login string `json:"login"`
Email string `json:"email"`
IsAdmin bool `json:"isAdmin"`
}
type AccountDTO struct {
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment