From 48d4580dd5e975de2e8207bb9b9a2f258711d38c Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sat, 20 Apr 2024 11:15:04 +0800 Subject: Clarify permission "HasAccess" behavior (#30585) Follow #30495 "HasAccess" behavior wasn't clear, to make it clear: * Use a new name `HasAnyUnitAccess`, it will be easier to review related code and permission problems. * Separate everyone access mode to a separate field, then all calls to HasAccess are reverted to old behavior before #30495. * Add new tests. --------- Co-authored-by: Giteabot --- tests/integration/api_repo_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/integration/api_repo_test.go') diff --git a/tests/integration/api_repo_test.go b/tests/integration/api_repo_test.go index 481732f8df..bc2720d51e 100644 --- a/tests/integration/api_repo_test.go +++ b/tests/integration/api_repo_test.go @@ -222,7 +222,7 @@ func TestAPISearchRepo(t *testing.T) { assert.Len(t, repoNames, expected.count) for _, repo := range body.Data { r := getRepo(t, repo.ID) - hasAccess, err := access_model.HasAccess(db.DefaultContext, userID, r) + hasAccess, err := access_model.HasAnyUnitAccess(db.DefaultContext, userID, r) assert.NoError(t, err, "Error when checking if User: %d has access to %s: %v", userID, repo.FullName, err) assert.True(t, hasAccess, "User: %d does not have access to %s", userID, repo.FullName) -- cgit v1.2.3