Skip to content

chore: remove read all provisioners from users #14801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add unit test
  • Loading branch information
Emyrk committed Sep 25, 2024
commit e02e65dc9ab8f53c55f7fc9009abe51d77d8c7fb
7 changes: 6 additions & 1 deletion enterprise/coderd/provisionerdaemons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ func TestGetProvisionerDaemons(t *testing.T) {
t.Parallel()
dv := coderdtest.DeploymentValues(t)
dv.Experiments = []string{string(codersdk.ExperimentMultiOrganization)}
client, _ := coderdenttest.New(t, &coderdenttest.Options{
client, first := coderdenttest.New(t, &coderdenttest.Options{
Options: &coderdtest.Options{
DeploymentValues: dv,
},
Expand All @@ -753,6 +753,7 @@ func TestGetProvisionerDaemons(t *testing.T) {
})
org := coderdenttest.CreateOrganization(t, client, coderdenttest.CreateOrganizationOptions{})
orgAdmin, _ := coderdtest.CreateAnotherUser(t, client, org.ID, rbac.ScopedRoleOrgAdmin(org.ID))
outsideOrg, _ := coderdtest.CreateAnotherUser(t, client, first.OrganizationID)

res, err := orgAdmin.CreateProvisionerKey(context.Background(), org.ID, codersdk.CreateProvisionerKeyRequest{
Name: "my-key",
Expand Down Expand Up @@ -800,5 +801,9 @@ func TestGetProvisionerDaemons(t *testing.T) {
assert.Equal(t, buildinfo.Version(), pkDaemons[0].Daemons[0].Version)
assert.Equal(t, proto.CurrentVersion.String(), pkDaemons[0].Daemons[0].APIVersion)
assert.Equal(t, keys[0].ID, pkDaemons[0].Daemons[0].KeyID)

// Verify user outside the org cannot read the provisioners
_, err = outsideOrg.ListProvisionerKeyDaemons(ctx, org.ID)
require.Error(t, err)
})
}
Loading