summaryrefslogtreecommitdiffstats
path: root/modules/context/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r--modules/context/repo.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index f41505e7ac..4c32e846eb 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -204,7 +204,13 @@ func RetrieveTemplateRepo(ctx *Context, repo *models.Repository) {
return
}
- if !repo.TemplateRepo.CheckUnitUser(ctx.User.ID, ctx.User.IsAdmin, models.UnitTypeCode) {
+ perm, err := models.GetUserRepoPermission(repo.TemplateRepo, ctx.User)
+ if err != nil {
+ ctx.ServerError("GetUserRepoPermission", err)
+ return
+ }
+
+ if !perm.CanRead(models.UnitTypeCode) {
repo.TemplateID = 0
}
}