mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-10 04:38:39 +01:00
remove unused in routers/api/v1/api.go
This commit is contained in:
parent
f02a372c65
commit
a399a5ac3f
@ -455,28 +455,6 @@ func reqRepoWriter(unitTypes ...unit.Type) func(ctx *context.APIContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reqRepoCommitStatusWriter user should have a permission to write to commit
|
|
||||||
// statuses, or write to a repo, or be a site admin
|
|
||||||
func reqRepoCommitStatusWriter(unitTypes ...unit.Type) func(ctx *context.APIContext) {
|
|
||||||
return func(ctx *context.APIContext) {
|
|
||||||
// TODO(not7cd)
|
|
||||||
if !ctx.IsUserRepoWriter(unitTypes) && !ctx.IsUserRepoAdmin() && !ctx.IsUserSiteAdmin() {
|
|
||||||
ctx.APIError(http.StatusForbidden, "user should have a permission to write to a repo")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(not7cd): do I need this?
|
|
||||||
// // reqRepoBranchWriter user should have a permission to write to a branch, or be a site admin
|
|
||||||
// func reqRepoBranchWriter(ctx *context.APIContext) {
|
|
||||||
// options, ok := web.GetForm(ctx).(api.FileOptionInterface)
|
|
||||||
// if !ok || (!ctx.Repo.CanWriteToBranch(ctx, ctx.Doer, options.Branch()) && !ctx.IsUserSiteAdmin()) {
|
|
||||||
// ctx.APIError(http.StatusForbidden, "user should have a permission to write to this branch")
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// reqRepoReader user should have specific read permission or be a repo admin or a site admin
|
// reqRepoReader user should have specific read permission or be a repo admin or a site admin
|
||||||
func reqRepoReader(unitType unit.Type) func(ctx *context.APIContext) {
|
func reqRepoReader(unitType unit.Type) func(ctx *context.APIContext) {
|
||||||
return func(ctx *context.APIContext) {
|
return func(ctx *context.APIContext) {
|
||||||
@ -487,18 +465,6 @@ func reqRepoReader(unitType unit.Type) func(ctx *context.APIContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reqRepoReader user should have specific commit status read permission, or
|
|
||||||
// repo read permission, or be a repo admin or a site admin
|
|
||||||
func reqRepoCommitStatusReader(unitType unit.Type) func(ctx *context.APIContext) {
|
|
||||||
return func(ctx *context.APIContext) {
|
|
||||||
// TODO(not7cd)
|
|
||||||
if !ctx.Repo.CanRead(unitType) && !ctx.IsUserRepoAdmin() && !ctx.IsUserSiteAdmin() {
|
|
||||||
ctx.APIError(http.StatusForbidden, "user should have specific read permission or be a repo admin or a site admin")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// reqAnyRepoReader user should have any permission to read repository or permissions of site admin
|
// reqAnyRepoReader user should have any permission to read repository or permissions of site admin
|
||||||
func reqAnyRepoReader() func(ctx *context.APIContext) {
|
func reqAnyRepoReader() func(ctx *context.APIContext) {
|
||||||
return func(ctx *context.APIContext) {
|
return func(ctx *context.APIContext) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user