45 lines
951 B
Go
45 lines
951 B
Go
package org
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"code.gitea.io/gitea/models"
|
|
"code.gitea.io/gitea/modules/context"
|
|
)
|
|
|
|
func AddTeamAllRepository(ctx *context.APIContext) {
|
|
if ctx.Written() {
|
|
return
|
|
}
|
|
|
|
if ctx.Org.Team.IncludesAllRepositories {
|
|
ctx.Error(http.StatusForbidden, "", "Team include all repository not be allow to edit")
|
|
return
|
|
}
|
|
|
|
if err := models.AddAllRepositories(ctx.Org.Team); err != nil {
|
|
ctx.Error(http.StatusInternalServerError, "AddAllRepositories", err)
|
|
return
|
|
}
|
|
|
|
ctx.Status(http.StatusNoContent)
|
|
}
|
|
|
|
func RemoveTeamAllRepository(ctx *context.APIContext) {
|
|
|
|
if ctx.Written() {
|
|
return
|
|
}
|
|
|
|
if ctx.Org.Team.IncludesAllRepositories {
|
|
ctx.Error(http.StatusForbidden, "", "Team include all repository not be allow to edit")
|
|
return
|
|
}
|
|
|
|
if err := models.RemoveAllRepositories(ctx.Org.Team); err != nil {
|
|
ctx.Error(http.StatusInternalServerError, "RemoveAllRepositories", err)
|
|
return
|
|
}
|
|
ctx.Status(http.StatusNoContent)
|
|
}
|