summaryrefslogtreecommitdiffstats
path: root/routers/repo/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/http.go')
-rw-r--r--routers/repo/http.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go
index 82c07b9d85..b1c7cbbdb8 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -77,8 +77,10 @@ func HTTP(ctx *context.Context) {
}
isWiki := false
+ var unitType = models.UnitTypeCode
if strings.HasSuffix(reponame, ".wiki") {
isWiki = true
+ unitType = models.UnitTypeWiki
reponame = reponame[:len(reponame)-5]
}
@@ -204,6 +206,12 @@ func HTTP(ctx *context.Context) {
}
}
+ if !repo.CheckUnitUser(authUser.ID, unitType) {
+ ctx.HandleText(http.StatusForbidden, fmt.Sprintf("User %s does not have allowed access to repository %s 's code",
+ authUser.Name, repo.RepoPath()))
+ return
+ }
+
environ = []string{
models.EnvRepoUsername + "=" + username,
models.EnvRepoName + "=" + reponame,