From eabbddcd98717ef20d8475e819f403c50f4a9787 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 28 Nov 2018 19:26:14 +0800 Subject: Restrict permission check on repositories and fix some problems (#5314) * fix units permission problems * fix some bugs and merge LoadUnits to repoAssignment * refactor permission struct and add some copyright heads * remove unused codes * fix routes units check * improve permission check * add unit tests for permission * fix typo * fix tests * fix some routes * fix api permission check * improve permission check * fix some permission check * fix tests * fix tests * improve some permission check * fix some permission check * refactor AccessLevel * fix bug * fix tests * fix tests * fix tests * fix AccessLevel * rename CanAccess * fix tests * fix comment * fix bug * add missing unit for test repos * fix bug * rename some functions * fix routes check --- routers/api/v1/repo/fork.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'routers/api/v1/repo/fork.go') diff --git a/routers/api/v1/repo/fork.go b/routers/api/v1/repo/fork.go index 843559d523..d10f668712 100644 --- a/routers/api/v1/repo/fork.go +++ b/routers/api/v1/repo/fork.go @@ -7,7 +7,6 @@ package repo import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" - "code.gitea.io/gitea/routers/api/v1/utils" api "code.gitea.io/sdk/gitea" ) @@ -40,7 +39,7 @@ func ListForks(ctx *context.APIContext) { } apiForks := make([]*api.Repository, len(forks)) for i, fork := range forks { - access, err := models.AccessLevel(utils.UserID(ctx), fork) + access, err := models.AccessLevel(ctx.User, fork) if err != nil { ctx.Error(500, "AccessLevel", err) return -- cgit v1.2.3