Skip to content

Commit f80caa5

Browse files
gzsombortechknowlogick
authored andcommitted
Fix #6234 : Check organization visibility before everything else (#6235)
* Fix #6234 : Check organization visibility before everything else * Ensure that Owner is available in the Repo
1 parent b257e04 commit f80caa5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

modules/context/repo.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,17 @@ func RedirectToRepo(ctx *Context, redirectRepoID int64) {
212212

213213
func repoAssignment(ctx *Context, repo *models.Repository) {
214214
var err error
215+
if err = repo.GetOwner(); err != nil {
216+
ctx.ServerError("GetOwner", err)
217+
return
218+
}
219+
220+
if repo.Owner.IsOrganization() {
221+
if !models.HasOrgVisible(repo.Owner, ctx.User) {
222+
ctx.NotFound("HasOrgVisible", nil)
223+
return
224+
}
225+
}
215226
ctx.Repo.Permission, err = models.GetUserRepoPermission(repo, ctx.User)
216227
if err != nil {
217228
ctx.ServerError("GetUserRepoPermission", err)

0 commit comments

Comments
 (0)