Skip to content

Commit a399a5a

Browse files
committed
remove unused in routers/api/v1/api.go
1 parent f02a372 commit a399a5a

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

routers/api/v1/api.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -455,28 +455,6 @@ func reqRepoWriter(unitTypes ...unit.Type) func(ctx *context.APIContext) {
455455
}
456456
}
457457

458-
// reqRepoCommitStatusWriter user should have a permission to write to commit
459-
// statuses, or write to a repo, or be a site admin
460-
func reqRepoCommitStatusWriter(unitTypes ...unit.Type) func(ctx *context.APIContext) {
461-
return func(ctx *context.APIContext) {
462-
// TODO(not7cd)
463-
if !ctx.IsUserRepoWriter(unitTypes) && !ctx.IsUserRepoAdmin() && !ctx.IsUserSiteAdmin() {
464-
ctx.APIError(http.StatusForbidden, "user should have a permission to write to a repo")
465-
return
466-
}
467-
}
468-
}
469-
470-
// TODO(not7cd): do I need this?
471-
// // reqRepoBranchWriter user should have a permission to write to a branch, or be a site admin
472-
// func reqRepoBranchWriter(ctx *context.APIContext) {
473-
// options, ok := web.GetForm(ctx).(api.FileOptionInterface)
474-
// if !ok || (!ctx.Repo.CanWriteToBranch(ctx, ctx.Doer, options.Branch()) && !ctx.IsUserSiteAdmin()) {
475-
// ctx.APIError(http.StatusForbidden, "user should have a permission to write to this branch")
476-
// return
477-
// }
478-
// }
479-
480458
// reqRepoReader user should have specific read permission or be a repo admin or a site admin
481459
func reqRepoReader(unitType unit.Type) func(ctx *context.APIContext) {
482460
return func(ctx *context.APIContext) {
@@ -487,18 +465,6 @@ func reqRepoReader(unitType unit.Type) func(ctx *context.APIContext) {
487465
}
488466
}
489467

490-
// reqRepoReader user should have specific commit status read permission, or
491-
// repo read permission, or be a repo admin or a site admin
492-
func reqRepoCommitStatusReader(unitType unit.Type) func(ctx *context.APIContext) {
493-
return func(ctx *context.APIContext) {
494-
// TODO(not7cd)
495-
if !ctx.Repo.CanRead(unitType) && !ctx.IsUserRepoAdmin() && !ctx.IsUserSiteAdmin() {
496-
ctx.APIError(http.StatusForbidden, "user should have specific read permission or be a repo admin or a site admin")
497-
return
498-
}
499-
}
500-
}
501-
502468
// reqAnyRepoReader user should have any permission to read repository or permissions of site admin
503469
func reqAnyRepoReader() func(ctx *context.APIContext) {
504470
return func(ctx *context.APIContext) {

0 commit comments

Comments
 (0)