Skip to content

Commit

Permalink
Fix nil context user (#9099)
Browse files Browse the repository at this point in the history
Signed-off-by: jolheiser <john.olheiser@gmail.com>
  • Loading branch information
jolheiser authored and zeripath committed Nov 20, 2019
1 parent 1615b3c commit 8f49b12
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/context/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 8f49b12

Please sign in to comment.