1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-10 11:38:20 +00:00

Fix system admin cannot fork or get private fork with API (#33401) (#33417)

Backport #33401 by @lunny

Fix #33368

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Giteabot
2025-01-28 02:43:16 +08:00
committed by GitHub
parent 2674d27fb8
commit b6fd8741ee
4 changed files with 47 additions and 13 deletions

View File

@@ -258,9 +258,11 @@ type findForksOptions struct {
}
func (opts findForksOptions) ToConds() builder.Cond {
return builder.Eq{"fork_id": opts.RepoID}.And(
repo_model.AccessibleRepositoryCondition(opts.Doer, unit.TypeInvalid),
)
cond := builder.Eq{"fork_id": opts.RepoID}
if opts.Doer != nil && opts.Doer.IsAdmin {
return cond
}
return cond.And(repo_model.AccessibleRepositoryCondition(opts.Doer, unit.TypeInvalid))
}
// FindForks returns all the forks of the repository