diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/context/repo.go | 3 | ||||
-rw-r--r-- | services/convert/package.go | 2 | ||||
-rw-r--r-- | services/repository/delete.go | 2 | ||||
-rw-r--r-- | services/repository/transfer.go | 2 | ||||
-rw-r--r-- | services/repository/transfer_test.go | 4 |
5 files changed, 6 insertions, 7 deletions
diff --git a/services/context/repo.go b/services/context/repo.go index 1f4c698afc..b17f99eb17 100644 --- a/services/context/repo.go +++ b/services/context/repo.go @@ -374,8 +374,7 @@ func repoAssignment(ctx *Context, repo *repo_model.Repository) { return } - // Check access. - if !ctx.Repo.Permission.HasAccess() { + if !ctx.Repo.Permission.HasAnyUnitAccessOrEveryoneAccess() { if ctx.FormString("go-get") == "1" { EarlyResponseForGoGetMeta(ctx) return diff --git a/services/convert/package.go b/services/convert/package.go index b5fca21a3c..b27992bea9 100644 --- a/services/convert/package.go +++ b/services/convert/package.go @@ -21,7 +21,7 @@ func ToPackage(ctx context.Context, pd *packages.PackageDescriptor, doer *user_m return nil, err } - if permission.HasAccess() { + if permission.HasAnyUnitAccess() { repo = ToRepo(ctx, pd.Repository, permission) } } diff --git a/services/repository/delete.go b/services/repository/delete.go index 7c7dfe2ddd..cd779b05c3 100644 --- a/services/repository/delete.go +++ b/services/repository/delete.go @@ -374,7 +374,7 @@ func removeRepositoryFromTeam(ctx context.Context, t *organization.Team, repo *r return fmt.Errorf("GetTeamMembers: %w", err) } for _, member := range teamMembers { - has, err := access_model.HasAccess(ctx, member.ID, repo) + has, err := access_model.HasAnyUnitAccess(ctx, member.ID, repo) if err != nil { return err } else if has { diff --git a/services/repository/transfer.go b/services/repository/transfer.go index 83d3032188..3d0bce18d0 100644 --- a/services/repository/transfer.go +++ b/services/repository/transfer.go @@ -387,7 +387,7 @@ func StartRepositoryTransfer(ctx context.Context, doer, newOwner *user_model.Use } // In case the new owner would not have sufficient access to the repo, give access rights for read - hasAccess, err := access_model.HasAccess(ctx, newOwner.ID, repo) + hasAccess, err := access_model.HasAnyUnitAccess(ctx, newOwner.ID, repo) if err != nil { return err } diff --git a/services/repository/transfer_test.go b/services/repository/transfer_test.go index c3f03d6638..67799eddcc 100644 --- a/services/repository/transfer_test.go +++ b/services/repository/transfer_test.go @@ -67,13 +67,13 @@ func TestStartRepositoryTransferSetPermission(t *testing.T) { repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 3}) repo.Owner = unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}) - hasAccess, err := access_model.HasAccess(db.DefaultContext, recipient.ID, repo) + hasAccess, err := access_model.HasAnyUnitAccess(db.DefaultContext, recipient.ID, repo) assert.NoError(t, err) assert.False(t, hasAccess) assert.NoError(t, StartRepositoryTransfer(db.DefaultContext, doer, recipient, repo, nil)) - hasAccess, err = access_model.HasAccess(db.DefaultContext, recipient.ID, repo) + hasAccess, err = access_model.HasAnyUnitAccess(db.DefaultContext, recipient.ID, repo) assert.NoError(t, err) assert.True(t, hasAccess) |