func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) { org, err := models.GetOrgByName(ctx.Params(":org")) if err != nil { if models.IsErrUserNotExist(err) { ctx.Error(422, "", err) } else { ctx.Error(500, "GetOrgByName", err) } return } if !org.IsOwnedBy(ctx.User.ID) { ctx.Error(403, "", "Given user is not owner of organization.") return } CreateUserRepo(ctx, org, opt) }
// POST /orgs/:org/repos // https://developer.github.com/v3/repos/#create func CreateOrgRepo(ctx *middleware.Context, opt api.CreateRepoOption) { org, err := models.GetOrgByName(ctx.Params(":org")) if err != nil { if err == models.ErrUserNotExist { ctx.Error(404) } else { ctx.Error(500) } return } if !org.IsOwnedBy(ctx.User.Id) { ctx.Error(403) return } createRepo(ctx, org, opt) }