mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 09:09:02 +00:00
Fix nil context user (#9099)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
1615b3c187
commit
8f49b1232a
|
@ -204,7 +204,13 @@ func RetrieveTemplateRepo(ctx *Context, repo *models.Repository) {
|
||||||
return
|
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
|
repo.TemplateID = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue