Started Account -> Organization rename
This commit is contained in:
+3
-3
@@ -6,7 +6,7 @@ import (
|
||||
m "github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
|
||||
func GetAccount(c *middleware.Context) {
|
||||
func GetOrg(c *middleware.Context) {
|
||||
query := m.GetAccountByIdQuery{Id: c.AccountId}
|
||||
|
||||
if err := bus.Dispatch(&query); err != nil {
|
||||
@@ -27,7 +27,7 @@ func GetAccount(c *middleware.Context) {
|
||||
c.JSON(200, &account)
|
||||
}
|
||||
|
||||
func CreateAccount(c *middleware.Context, cmd m.CreateAccountCommand) {
|
||||
func CreateOrg(c *middleware.Context, cmd m.CreateAccountCommand) {
|
||||
cmd.UserId = c.UserId
|
||||
|
||||
if err := bus.Dispatch(&cmd); err != nil {
|
||||
@@ -38,7 +38,7 @@ func CreateAccount(c *middleware.Context, cmd m.CreateAccountCommand) {
|
||||
c.JsonOK("Account created")
|
||||
}
|
||||
|
||||
func UpdateAccount(c *middleware.Context, cmd m.UpdateAccountCommand) {
|
||||
func UpdateOrg(c *middleware.Context, cmd m.UpdateAccountCommand) {
|
||||
cmd.AccountId = c.AccountId
|
||||
|
||||
if err := bus.Dispatch(&cmd); err != nil {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
m "github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
|
||||
func AddAccountUser(c *middleware.Context, cmd m.AddAccountUserCommand) {
|
||||
func AddOrgUser(c *middleware.Context, cmd m.AddAccountUserCommand) {
|
||||
if !cmd.Role.IsValid() {
|
||||
c.JsonApiErr(400, "Invalid role specified", nil)
|
||||
return
|
||||
@@ -37,7 +37,7 @@ func AddAccountUser(c *middleware.Context, cmd m.AddAccountUserCommand) {
|
||||
c.JsonOK("User added to account")
|
||||
}
|
||||
|
||||
func GetAccountUsers(c *middleware.Context) {
|
||||
func GetOrgUsers(c *middleware.Context) {
|
||||
query := m.GetAccountUsersQuery{AccountId: c.AccountId}
|
||||
|
||||
if err := bus.Dispatch(&query); err != nil {
|
||||
@@ -48,7 +48,7 @@ func GetAccountUsers(c *middleware.Context) {
|
||||
c.JSON(200, query.Result)
|
||||
}
|
||||
|
||||
func RemoveAccountUser(c *middleware.Context) {
|
||||
func RemoveOrgUser(c *middleware.Context) {
|
||||
userId := c.ParamsInt64(":id")
|
||||
|
||||
cmd := m.RemoveAccountUserCommand{AccountId: c.AccountId, UserId: userId}
|
||||
|
||||
+7
-7
@@ -54,13 +54,13 @@ func Register(r *macaron.Macaron) {
|
||||
})
|
||||
|
||||
// account
|
||||
r.Group("/account", func() {
|
||||
r.Get("/", GetAccount)
|
||||
r.Post("/", bind(m.CreateAccountCommand{}), CreateAccount)
|
||||
r.Put("/", bind(m.UpdateAccountCommand{}), UpdateAccount)
|
||||
r.Post("/users", bind(m.AddAccountUserCommand{}), AddAccountUser)
|
||||
r.Get("/users", GetAccountUsers)
|
||||
r.Delete("/users/:id", RemoveAccountUser)
|
||||
r.Group("/org", func() {
|
||||
r.Get("/", GetOrg)
|
||||
r.Post("/", bind(m.CreateAccountCommand{}), CreateOrg)
|
||||
r.Put("/", bind(m.UpdateAccountCommand{}), UpdateOrg)
|
||||
r.Post("/users", bind(m.AddAccountUserCommand{}), AddOrgUser)
|
||||
r.Get("/users", GetOrgUsers)
|
||||
r.Delete("/users/:id", RemoveOrgUser)
|
||||
}, reqAccountAdmin)
|
||||
|
||||
// auth api keys
|
||||
|
||||
Reference in New Issue
Block a user