Skip to content

Commit a0a77c9

Browse files
authored
Fix deadlock when deleting team user (go-gitea#13093)
Backport go-gitea#13092 `models.getUserRepoPermission(...)` calls `HasOrgVisible` which uses `models.x` potentially outside of the transaction `e` provided as an argument to `getUserRepoPermission`. This PR switches to use `hasOrgVisible(e, ...)`. Fix go-gitea#12983 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 40a7660 commit a0a77c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/repo_permission.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func getUserRepoPermission(e Engine, repo *Repository, user *User) (perm Permiss
178178

179179
// Prevent strangers from checking out public repo of private orginization
180180
// Allow user if they are collaborator of a repo within a private orginization but not a member of the orginization itself
181-
if repo.Owner.IsOrganization() && !HasOrgVisible(repo.Owner, user) && !isCollaborator {
181+
if repo.Owner.IsOrganization() && !hasOrgVisible(e, repo.Owner, user) && !isCollaborator {
182182
perm.AccessMode = AccessModeNone
183183
return
184184
}

0 commit comments

Comments
 (0)