Fix nil context user (#9099)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
tokarchuk/v1.17
John Olheiser 5 years ago committed by zeripath
parent 1615b3c187
commit 8f49b1232a
  1. 8
      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
}
}

Loading…
Cancel
Save