summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/api.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-05 17:13:13 -0500
committerUnknwon <u@gogs.io>2015-12-05 17:13:13 -0500
commit978dc00305f1af705ae8900977529bac6fa4c72b (patch)
tree67587da091f590282fd2c120197249fd9b07b98f /routers/api/v1/api.go
parentbf26808fb3fd55d74089e4f758aaac77be56f7ea (diff)
downloadgitea-978dc00305f1af705ae8900977529bac6fa4c72b.tar.gz
gitea-978dc00305f1af705ae8900977529bac6fa4c72b.zip
APIs: admin users
Diffstat (limited to 'routers/api/v1/api.go')
-rw-r--r--routers/api/v1/api.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 01577bba7d..1ac60c26b9 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -15,6 +15,7 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/middleware"
+ "github.com/gogits/gogs/routers/api/v1/admin"
"github.com/gogits/gogs/routers/api/v1/misc"
"github.com/gogits/gogs/routers/api/v1/repo"
"github.com/gogits/gogs/routers/api/v1/user"
@@ -132,8 +133,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Group("/users", func() {
m.Group("/:username", func() {
- m.Combo("/keys").Get(user.ListPublicKeys).
- Post(ReqAdmin(), user.CreateUserPublicKey)
+ m.Get("/keys", user.ListPublicKeys)
})
}, ReqToken())
@@ -179,5 +179,17 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Any("/*", func(ctx *middleware.Context) {
ctx.Error(404)
})
+
+ m.Group("/admin", func() {
+ m.Group("/users", func() {
+ m.Post("", bind(api.CreateUserOption{}), admin.CreateUser)
+
+ m.Group("/:username", func() {
+ m.Combo("").Patch(bind(api.EditUserOption{}), admin.EditUser).
+ Delete(admin.DeleteUser)
+ m.Post("/keys", admin.CreatePublicKey)
+ })
+ })
+ }, ReqAdmin())
})
}