@@ -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 
481459func  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 
503469func  reqAnyRepoReader () func (ctx  * context.APIContext ) {
504470	return  func (ctx  * context.APIContext ) {
@@ -1433,8 +1399,8 @@ func Routes() *web.Router {
14331399				}, mustAllowPulls , reqRepoReader (unit .TypeCode ), context .ReferencesGitRepo ())
14341400				m .Group ("/statuses" , func () {
14351401					m .Combo ("/{sha}" ).Get (repo .GetCommitStatuses ).
1436- 						Post (reqToken (), reqRepoCommitStatusWriter (unit .TypeCode ), bind (api.CreateStatusOption {}), repo .NewCommitStatus )
1437- 				}, reqRepoCommitStatusReader (unit .TypeCode ))
1402+ 						Post (reqToken (), reqRepoWriter (unit .TypeCommitStatus ), bind (api.CreateStatusOption {}), repo .NewCommitStatus )
1403+ 				}, reqRepoWriter (unit .TypeCommitStatus ))
14381404				m .Group ("/commits" , func () {
14391405					m .Get ("" , context .ReferencesGitRepo (), repo .GetAllCommits )
14401406					m .Group ("/{ref}" , func () {
0 commit comments