mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
feat: add authorization reducer support to SearchRepoOptions
This commit is contained in:
parent
e870b9cb74
commit
4bd81d3363
1 changed files with 6 additions and 0 deletions
|
|
@ -186,6 +186,8 @@ type SearchRepoOptions struct {
|
|||
// - Don't show forks, when opts.Fork is OptionalBoolNone.
|
||||
// - Do not display repositories that don't have a description, an icon and topics.
|
||||
OnlyShowRelevant bool
|
||||
// Filters repositories based upon optional authorization restrictions.
|
||||
AuthorizationReducer RepositoryAuthorizationReducer
|
||||
}
|
||||
|
||||
// UserOwnedRepoCond returns user ownered repositories
|
||||
|
|
@ -518,6 +520,10 @@ func SearchRepositoryCondition(opts *SearchRepoOptions) builder.Cond {
|
|||
cond = cond.And(subQueryCond)
|
||||
}
|
||||
|
||||
if opts.AuthorizationReducer != nil {
|
||||
cond = cond.And(opts.AuthorizationReducer.RepoReadAccessFilter())
|
||||
}
|
||||
|
||||
return cond
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue