mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 14:00:04 +02:00
#1692 API: admin create repo
This commit is contained in:
parent
1e7e092992
commit
1c9dd11ba7
3 changed files with 27 additions and 3 deletions
|
@ -113,7 +113,7 @@ func ListMyRepos(ctx *middleware.Context) {
|
|||
ctx.JSON(200, &repos)
|
||||
}
|
||||
|
||||
func createRepo(ctx *middleware.Context, owner *models.User, opt api.CreateRepoOption) {
|
||||
func CreateUserRepo(ctx *middleware.Context, owner *models.User, opt api.CreateRepoOption) {
|
||||
repo, err := models.CreateRepository(owner, models.CreateRepoOptions{
|
||||
Name: opt.Name,
|
||||
Description: opt.Description,
|
||||
|
@ -149,7 +149,7 @@ func Create(ctx *middleware.Context, opt api.CreateRepoOption) {
|
|||
ctx.APIError(422, "", "not allowed creating repository for organization")
|
||||
return
|
||||
}
|
||||
createRepo(ctx, ctx.User, opt)
|
||||
CreateUserRepo(ctx, ctx.User, opt)
|
||||
}
|
||||
|
||||
func CreateOrgRepo(ctx *middleware.Context, opt api.CreateRepoOption) {
|
||||
|
@ -167,7 +167,7 @@ func CreateOrgRepo(ctx *middleware.Context, opt api.CreateRepoOption) {
|
|||
ctx.APIError(403, "", "Given user is not owner of organization.")
|
||||
return
|
||||
}
|
||||
createRepo(ctx, org, opt)
|
||||
CreateUserRepo(ctx, org, opt)
|
||||
}
|
||||
|
||||
// https://github.com/gogits/go-gogs-client/wiki/Repositories#migrate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue