1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Add owner_name column for table repository for maintaince reason (#9717)

* Add owner_name column for table repository for maintaince reason

* refactor

* Fix tests

* fix test

* fix bug when fork repository

Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
Lunny Xiao
2020-01-12 17:36:21 +08:00
committed by GitHub
parent 65baacf227
commit 5765212c6d
18 changed files with 129 additions and 102 deletions

View File

@@ -164,10 +164,6 @@ func getUserRepoPermission(e Engine, repo *Repository, user *User) (perm Permiss
return
}
if repo.Owner == nil {
repo.mustOwner(e)
}
var isCollaborator bool
if user != nil {
isCollaborator, err = repo.isCollaborator(e, user.ID)
@@ -176,6 +172,10 @@ func getUserRepoPermission(e Engine, repo *Repository, user *User) (perm Permiss
}
}
if err = repo.getOwner(e); err != nil {
return
}
// Prevent strangers from checking out public repo of private orginization
// Allow user if they are collaborator of a repo within a private orginization but not a member of the orginization itself
if repo.Owner.IsOrganization() && !HasOrgVisible(repo.Owner, user) && !isCollaborator {