mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-04 12:26:12 +02:00
move group routes that don't depend on the org path parameter out of the /orgs/{org} route group
This commit is contained in:
parent
8fce091a48
commit
4bf17e9b21
@ -508,7 +508,6 @@ func reqGroupMembership(mode perm.AccessMode, needsCreatePerm bool) func(ctx *co
|
||||
return
|
||||
}
|
||||
canAccess, err := g.CanAccessAtLevel(ctx, ctx.Doer, mode)
|
||||
|
||||
if err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
return
|
||||
@ -1208,7 +1207,7 @@ func Routes() *web.Router {
|
||||
m.Combo("").Get(reqAnyRepoReader(), repo.Get).
|
||||
Delete(reqToken(), reqOwner(), repo.Delete).
|
||||
Patch(reqToken(), reqAdmin(), bind(api.EditRepoOption{}), repo.Edit)
|
||||
m.Post("/groups/move", reqToken(), bind(api.EditGroupOption{}), reqOrgMembership(), reqGroupMembership(perm.AccessModeWrite, false), repo.MoveRepoToGroup)
|
||||
m.Post("/groups/move", reqToken(), bind(api.MoveGroupOption{}), reqOrgMembership(), reqGroupMembership(perm.AccessModeWrite, false), repo.MoveRepoToGroup)
|
||||
m.Post("/generate", reqToken(), reqRepoReader(unit.TypeCode), bind(api.GenerateRepoOption{}), repo.Generate)
|
||||
m.Group("/transfer", func() {
|
||||
m.Post("", reqOwner(), bind(api.TransferRepoOption{}), repo.Transfer)
|
||||
@ -1718,7 +1717,6 @@ func Routes() *web.Router {
|
||||
}, reqToken(), reqOrgOwnership())
|
||||
m.Group("/groups", func() {
|
||||
m.Post("/new", reqToken(), reqGroupMembership(perm.AccessModeWrite, true), group.NewGroup)
|
||||
m.Post("/{group_id}/move", reqToken(), reqGroupMembership(perm.AccessModeWrite, false), group.MoveGroup)
|
||||
})
|
||||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryOrganization), orgAssignment(true), checkTokenPublicOnly())
|
||||
m.Group("/teams/{teamid}", func() {
|
||||
@ -1806,8 +1804,9 @@ func Routes() *web.Router {
|
||||
Get(reqGroupMembership(perm.AccessModeRead, false), group.GetGroup).
|
||||
Patch(reqToken(), reqGroupMembership(perm.AccessModeWrite, false), bind(api.EditGroupOption{}), group.EditGroup).
|
||||
Delete(reqToken(), reqGroupMembership(perm.AccessModeAdmin, false), group.DeleteGroup)
|
||||
m.Post("/move", reqToken(), reqGroupMembership(perm.AccessModeWrite, false), bind(api.MoveGroupOption{}), group.MoveGroup)
|
||||
m.Post("/new", reqToken(), reqGroupMembership(perm.AccessModeWrite, true), bind(api.NewGroupOption{}), group.NewSubGroup)
|
||||
})
|
||||
}, checkTokenPublicOnly())
|
||||
})
|
||||
return m
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ func NewSubGroup(ctx *context.APIContext) {
|
||||
|
||||
// MoveGroup - move a group to a different group in the same organization, or to the root level if
|
||||
func MoveGroup(ctx *context.APIContext) {
|
||||
// swagger:operation POST /orgs/{org}/groups/{group_id}/move repository-group groupMove
|
||||
// swagger:operation POST /groups/{group_id}/move repository-group groupMove
|
||||
// ---
|
||||
// summary: move a group to a different parent group
|
||||
// consumes:
|
||||
@ -112,11 +112,6 @@ func MoveGroup(ctx *context.APIContext) {
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: org
|
||||
// in: path
|
||||
// description: name of the organization
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: group_id
|
||||
// in: path
|
||||
// description: id of the group to move
|
||||
@ -174,7 +169,7 @@ func MoveGroup(ctx *context.APIContext) {
|
||||
|
||||
// EditGroup - update a group in an organization
|
||||
func EditGroup(ctx *context.APIContext) {
|
||||
// swagger:operation PATCH /orgs/{org}/groups/{group_id} repository-group groupEdit
|
||||
// swagger:operation PATCH /groups/{group_id} repository-group groupEdit
|
||||
// ---
|
||||
// summary: edits a group in an organization. only fields that are set will be changed.
|
||||
// consumes:
|
||||
@ -182,11 +177,6 @@ func EditGroup(ctx *context.APIContext) {
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: org
|
||||
// in: path
|
||||
// description: name of the organization
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: group_id
|
||||
// in: path
|
||||
// description: id of the group to edit
|
||||
@ -243,17 +233,12 @@ func EditGroup(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
func GetGroup(ctx *context.APIContext) {
|
||||
// swagger:operation GET /orgs/{org}/groups/{group_id} repository-group groupGet
|
||||
// swagger:operation GET /groups/{group_id} repository-group groupGet
|
||||
// ---
|
||||
// summary: gets a group in an organization
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: org
|
||||
// in: path
|
||||
// description: name of the organization
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: group_id
|
||||
// in: path
|
||||
// description: id of the group to retrieve
|
||||
@ -297,7 +282,7 @@ func GetGroup(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
func DeleteGroup(ctx *context.APIContext) {
|
||||
// swagger:operation DELETE /orgs/{org}/groups/{group_id} repositoryGroup groupDelete
|
||||
// swagger:operation DELETE /groups/{group_id} repositoryGroup groupDelete
|
||||
// ---
|
||||
// summary: Delete a repository group
|
||||
// produces:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user