feat: implement fine-grained access tokens in /user/starred & /users/{username}/starred

This commit is contained in:
Mathieu Fenniak 2026-02-24 18:58:04 -07:00 committed by Mathieu Fenniak
parent 5582faa0c7
commit 9c748e87e1
3 changed files with 89 additions and 4 deletions

View file

@ -17,13 +17,14 @@ import (
)
// GetStarredRepos returns the repos starred by a particular user
func GetStarredRepos(ctx context.Context, userID int64, private bool, listOptions db.ListOptions) ([]*Repository, error) {
func GetStarredRepos(ctx context.Context, userID int64, private bool, listOptions db.ListOptions, reducer RepositoryAuthorizationReducer) ([]*Repository, error) {
sess := db.GetEngine(ctx).
Where("star.uid=?", userID).
Join("LEFT", "star", "`repository`.id=`star`.repo_id")
if !private {
sess = sess.And("is_private=?", false)
}
sess = sess.And(reducer.RepoReadAccessFilter())
if listOptions.Page != 0 {
sess = db.SetSessionPagination(sess, &listOptions)