diff options
author | JakobDev <jakobdev@gmx.de> | 2023-10-03 12:30:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-03 10:30:41 +0000 |
commit | cc5df266808361c1dd3a1d17cbba712826a93d7e (patch) | |
tree | f77c59a61d3dc36f07b5b84596e4a1cde12b55cc /models/perm | |
parent | 08507e2760638124d75774c29ef37e692a88c02d (diff) | |
download | gitea-cc5df266808361c1dd3a1d17cbba712826a93d7e.tar.gz gitea-cc5df266808361c1dd3a1d17cbba712826a93d7e.zip |
Even more `db.DefaultContext` refactor (#27352)
Part of #27065
---------
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'models/perm')
-rw-r--r-- | models/perm/access/repo_permission.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/models/perm/access/repo_permission.go b/models/perm/access/repo_permission.go index 2027b87ecb..395ecdf1a5 100644 --- a/models/perm/access/repo_permission.go +++ b/models/perm/access/repo_permission.go @@ -261,16 +261,16 @@ func GetUserRepoPermission(ctx context.Context, repo *repo_model.Repository, use } // IsUserRealRepoAdmin check if this user is real repo admin -func IsUserRealRepoAdmin(repo *repo_model.Repository, user *user_model.User) (bool, error) { +func IsUserRealRepoAdmin(ctx context.Context, repo *repo_model.Repository, user *user_model.User) (bool, error) { if repo.OwnerID == user.ID { return true, nil } - if err := repo.LoadOwner(db.DefaultContext); err != nil { + if err := repo.LoadOwner(ctx); err != nil { return false, err } - accessMode, err := accessLevel(db.DefaultContext, user, repo) + accessMode, err := accessLevel(ctx, user, repo) if err != nil { return false, err } @@ -394,13 +394,13 @@ func getUsersWithAccessMode(ctx context.Context, repo *repo_model.Repository, mo } // GetRepoReaders returns all users that have explicit read access or higher to the repository. -func GetRepoReaders(repo *repo_model.Repository) (_ []*user_model.User, err error) { - return getUsersWithAccessMode(db.DefaultContext, repo, perm_model.AccessModeRead) +func GetRepoReaders(ctx context.Context, repo *repo_model.Repository) (_ []*user_model.User, err error) { + return getUsersWithAccessMode(ctx, repo, perm_model.AccessModeRead) } // GetRepoWriters returns all users that have write access to the repository. -func GetRepoWriters(repo *repo_model.Repository) (_ []*user_model.User, err error) { - return getUsersWithAccessMode(db.DefaultContext, repo, perm_model.AccessModeWrite) +func GetRepoWriters(ctx context.Context, repo *repo_model.Repository) (_ []*user_model.User, err error) { + return getUsersWithAccessMode(ctx, repo, perm_model.AccessModeWrite) } // IsRepoReader returns true if user has explicit read access or higher to the repository. |