mirror of
https://github.com/go-gitea/gitea
synced 2024-11-09 09:27:11 +01:00
api: implement endpoints for all org-project logic
This commit is contained in:
parent
f8ae9f730b
commit
0bd9d5bf02
@ -976,9 +976,9 @@ func Routes() *web.Router {
|
|||||||
m.Post("", bind(api.CreateProjectOption{}), org.CreateProject)
|
m.Post("", bind(api.CreateProjectOption{}), org.CreateProject)
|
||||||
m.Group("/{id}", func() {
|
m.Group("/{id}", func() {
|
||||||
m.Post("", bind(api.EditProjectColumnOption{}), org.AddColumnToProject)
|
m.Post("", bind(api.EditProjectColumnOption{}), org.AddColumnToProject)
|
||||||
|
m.Delete("", org.DeleteProject)
|
||||||
|
m.Put("", bind(api.CreateProjectOption{}), org.EditProject)
|
||||||
m.Post("/move", org.MoveColumns)
|
m.Post("/move", org.MoveColumns)
|
||||||
m.Post("/delete", org.DeleteProject)
|
|
||||||
m.Post("/edit", bind(api.CreateProjectOption{}), org.EditProject)
|
|
||||||
m.Post("/{action:open|close}", org.ChangeProjectStatus)
|
m.Post("/{action:open|close}", org.ChangeProjectStatus)
|
||||||
|
|
||||||
m.Group("/{columnID}", func() {
|
m.Group("/{columnID}", func() {
|
||||||
@ -998,20 +998,39 @@ func Routes() *web.Router {
|
|||||||
|
|
||||||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryUser), reqToken(), context.UserAssignmentAPI())
|
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryUser), reqToken(), context.UserAssignmentAPI())
|
||||||
|
|
||||||
// m.Group("orgs/{org}/-", func() {
|
// Organizations (requires orgs scope)
|
||||||
// m.Group("/projects", func() {
|
m.Group("orgs/{org}/-", func() {
|
||||||
// m.Group("", func() {
|
m.Group("/projects", func() {
|
||||||
// // m.Get("", org.Projects)
|
m.Group("", func() {
|
||||||
// // m.Get("/{id}", org.ViewProject)
|
m.Get("", org.GetProjects)
|
||||||
// }, reqUnitAccess(unit.TypeProjects, perm.AccessModeRead, true))
|
m.Get("/{id}", org.GetProject)
|
||||||
// m.Group("", func() {
|
}, reqUnitAccess(unit.TypeProjects, perm.AccessModeRead, true))
|
||||||
// m.Post("", bind(api.CreateProjectOption{}), org.CreateProject)
|
|
||||||
// m.Group("/{id}", func() {
|
m.Group("", func() {
|
||||||
// m.Post("/{action:open|close}", org.ChangeProjectStatus)
|
m.Post("", bind(api.CreateProjectOption{}), org.CreateProject)
|
||||||
// })
|
m.Group("/{id}", func() {
|
||||||
// }, reqUnitAccess(unit.TypeProjects, perm.AccessModeWrite, true))
|
m.Post("", bind(api.EditProjectColumnOption{}), org.AddColumnToProject)
|
||||||
// }, reqUnitAccess(unit.TypeProjects, perm.AccessModeRead, true), individualPermsChecker)
|
m.Delete("", org.DeleteProject)
|
||||||
// }, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryOrganization), reqToken(), orgAssignment(true))
|
m.Put("", bind(api.CreateProjectOption{}), org.EditProject)
|
||||||
|
m.Post("/move", org.MoveColumns)
|
||||||
|
m.Post("/{action:open|close}", org.ChangeProjectStatus)
|
||||||
|
|
||||||
|
m.Group("/{columnID}", func() {
|
||||||
|
m.Put("", bind(api.EditProjectColumnOption{}), org.EditProjectColumn)
|
||||||
|
m.Delete("", org.DeleteProjectColumn)
|
||||||
|
m.Post("/default", org.SetDefaultProjectColumn)
|
||||||
|
m.Post("/move", org.MoveIssues)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}, reqUnitAccess(unit.TypeProjects, perm.AccessModeWrite, true), func(ctx *context.APIContext) {
|
||||||
|
if ctx.ContextUser.IsIndividual() && ctx.ContextUser.ID != ctx.Doer.ID {
|
||||||
|
ctx.NotFound("NewProject", nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, reqUnitAccess(unit.TypeProjects, perm.AccessModeRead, true), individualPermsChecker)
|
||||||
|
|
||||||
|
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryOrganization), reqToken(), orgAssignment(true))
|
||||||
|
|
||||||
// Users (requires user scope)
|
// Users (requires user scope)
|
||||||
m.Group("/users", func() {
|
m.Group("/users", func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user