aboutsummaryrefslogtreecommitdiffstats
path: root/models/perm/access
diff options
context:
space:
mode:
Diffstat (limited to 'models/perm/access')
-rw-r--r--models/perm/access/access.go8
-rw-r--r--models/perm/access/access_test.go4
-rw-r--r--models/perm/access/repo_permission.go8
3 files changed, 10 insertions, 10 deletions
diff --git a/models/perm/access/access.go b/models/perm/access/access.go
index 48ecf78a8c..2d1b2daa62 100644
--- a/models/perm/access/access.go
+++ b/models/perm/access/access.go
@@ -85,8 +85,8 @@ func updateUserAccess(accessMap map[int64]*userAccess, user *user_model.User, mo
// FIXME: do cross-comparison so reduce deletions and additions to the minimum?
func refreshAccesses(ctx context.Context, repo *repo_model.Repository, accessMap map[int64]*userAccess) (err error) {
minMode := perm.AccessModeRead
- if err := repo.GetOwner(ctx); err != nil {
- return fmt.Errorf("GetOwner: %w", err)
+ if err := repo.LoadOwner(ctx); err != nil {
+ return fmt.Errorf("LoadOwner: %w", err)
}
// If the repo isn't private and isn't owned by a organization,
@@ -143,7 +143,7 @@ func refreshCollaboratorAccesses(ctx context.Context, repoID int64, accessMap ma
func RecalculateTeamAccesses(ctx context.Context, repo *repo_model.Repository, ignTeamID int64) (err error) {
accessMap := make(map[int64]*userAccess, 20)
- if err = repo.GetOwner(ctx); err != nil {
+ if err = repo.LoadOwner(ctx); err != nil {
return err
} else if !repo.Owner.IsOrganization() {
return fmt.Errorf("owner is not an organization: %d", repo.OwnerID)
@@ -199,7 +199,7 @@ func RecalculateUserAccess(ctx context.Context, repo *repo_model.Repository, uid
accessMode = collaborator.Mode
}
- if err = repo.GetOwner(ctx); err != nil {
+ if err = repo.LoadOwner(ctx); err != nil {
return err
} else if repo.Owner.IsOrganization() {
var teams []organization.Team
diff --git a/models/perm/access/access_test.go b/models/perm/access/access_test.go
index bd828a1e9d..79b131fe89 100644
--- a/models/perm/access/access_test.go
+++ b/models/perm/access/access_test.go
@@ -97,7 +97,7 @@ func TestRepository_RecalculateAccesses(t *testing.T) {
// test with organization repo
assert.NoError(t, unittest.PrepareTestDatabase())
repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 3})
- assert.NoError(t, repo1.GetOwner(db.DefaultContext))
+ assert.NoError(t, repo1.LoadOwner(db.DefaultContext))
_, err := db.GetEngine(db.DefaultContext).Delete(&repo_model.Collaboration{UserID: 2, RepoID: 3})
assert.NoError(t, err)
@@ -114,7 +114,7 @@ func TestRepository_RecalculateAccesses2(t *testing.T) {
// test with non-organization repo
assert.NoError(t, unittest.PrepareTestDatabase())
repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 4})
- assert.NoError(t, repo1.GetOwner(db.DefaultContext))
+ assert.NoError(t, repo1.LoadOwner(db.DefaultContext))
_, err := db.GetEngine(db.DefaultContext).Delete(&repo_model.Collaboration{UserID: 4, RepoID: 4})
assert.NoError(t, err)
diff --git a/models/perm/access/repo_permission.go b/models/perm/access/repo_permission.go
index a6bf9b6744..ee76e48200 100644
--- a/models/perm/access/repo_permission.go
+++ b/models/perm/access/repo_permission.go
@@ -175,7 +175,7 @@ func GetUserRepoPermission(ctx context.Context, repo *repo_model.Repository, use
}
}
- if err = repo.GetOwner(ctx); err != nil {
+ if err = repo.LoadOwner(ctx); err != nil {
return
}
@@ -210,7 +210,7 @@ func GetUserRepoPermission(ctx context.Context, repo *repo_model.Repository, use
return
}
- if err = repo.GetOwner(ctx); err != nil {
+ if err = repo.LoadOwner(ctx); err != nil {
return
}
if !repo.Owner.IsOrganization() {
@@ -281,7 +281,7 @@ func IsUserRealRepoAdmin(repo *repo_model.Repository, user *user_model.User) (bo
return true, nil
}
- if err := repo.GetOwner(db.DefaultContext); err != nil {
+ if err := repo.LoadOwner(db.DefaultContext); err != nil {
return false, err
}
@@ -378,7 +378,7 @@ func HasAccess(ctx context.Context, userID int64, repo *repo_model.Repository) (
// getUsersWithAccessMode returns users that have at least given access mode to the repository.
func getUsersWithAccessMode(ctx context.Context, repo *repo_model.Repository, mode perm_model.AccessMode) (_ []*user_model.User, err error) {
- if err = repo.GetOwner(ctx); err != nil {
+ if err = repo.LoadOwner(ctx); err != nil {
return nil, err
}