chore: protect organization endpoints with license (#14001)

* chore: move multi-org endpoints into enterprise directory

All multi-organization features are gated behind "premium" licenses. Enterprise licenses can no longer
access organization CRUD.
This commit is contained in:
Steven Masley
2024-07-25 16:07:53 -05:00
committed by GitHub
parent 915f69080a
commit 7ea1a4c686
37 changed files with 2222 additions and 1678 deletions
-37
View File
@@ -110,41 +110,4 @@ func TestTemplateList(t *testing.T) {
pty.ExpectMatch("No templates found")
pty.ExpectMatch("Create one:")
})
t.Run("MultiOrg", func(t *testing.T) {
t.Parallel()
client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true})
owner := coderdtest.CreateFirstUser(t, client)
// Template in the first organization
firstVersion := coderdtest.CreateTemplateVersion(t, client, owner.OrganizationID, nil)
_ = coderdtest.AwaitTemplateVersionJobCompleted(t, client, firstVersion.ID)
_ = coderdtest.CreateTemplate(t, client, owner.OrganizationID, firstVersion.ID)
secondOrg := coderdtest.CreateOrganization(t, client, coderdtest.CreateOrganizationOptions{
// Listing templates does not require the template actually completes.
// We cannot provision an external provisioner in AGPL tests.
IncludeProvisionerDaemon: false,
})
secondVersion := coderdtest.CreateTemplateVersion(t, client, secondOrg.ID, nil)
_ = coderdtest.CreateTemplate(t, client, secondOrg.ID, secondVersion.ID)
// Create a site wide template admin
templateAdmin, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID, rbac.RoleTemplateAdmin())
inv, root := clitest.New(t, "templates", "list", "--output=json")
clitest.SetupConfig(t, templateAdmin, root)
ctx, cancelFunc := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancelFunc()
out := bytes.NewBuffer(nil)
inv.Stdout = out
err := inv.WithContext(ctx).Run()
require.NoError(t, err)
var templates []codersdk.Template
require.NoError(t, json.Unmarshal(out.Bytes(), &templates))
require.Len(t, templates, 2)
})
}