Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3b04bd

Browse files
committed
premium license has multi-org enabled
1 parentb27ca7e commitf3b04bd

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

‎codersdk/deployment.go‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ func (n FeatureName) Humanize() string {
109109
}
110110

111111
// AlwaysEnable returns if the feature is always enabled if entitled.
112-
// Warning: We don't know if we need this functionality.
113-
// This method may disappear at any time.
112+
// This is required because some features are only enabled if they are entitled
113+
// and not required.
114+
// E.g: "multiple-organizations" is disabled by default in AGPL and enterprise
115+
// deployments. This feature should only be enabled for premium deployments
116+
// when it is entitled.
114117
func (nFeatureName)AlwaysEnable()bool {
115118
returnmap[FeatureName]bool{
116119
FeatureMultipleExternalAuth:true,
@@ -119,6 +122,7 @@ func (n FeatureName) AlwaysEnable() bool {
119122
FeatureWorkspaceBatchActions:true,
120123
FeatureHighAvailability:true,
121124
FeatureCustomRoles:true,
125+
FeatureMultipleOrganizations:true,
122126
}[n]
123127
}
124128

‎enterprise/coderd/coderd.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,6 @@ func (api *API) updateEntitlements(ctx context.Context) error {
582582
codersdk.FeatureUserRoleManagement:true,
583583
codersdk.FeatureAccessControl:true,
584584
codersdk.FeatureControlSharedPorts:true,
585-
codersdk.FeatureMultipleOrganizations:true,
586585
})
587586
iferr!=nil {
588587
returnerr

‎enterprise/coderd/license/license_test.go‎

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,18 @@ func TestLicenseEntitlements(t *testing.T) {
679679
DeploymentIDs:nil,
680680
Trial:false,
681681
FeatureSet:codersdk.FeatureSetEnterprise,
682-
AllFeatures:false,
682+
AllFeatures:true,
683+
}).Valid(time.Now())
684+
}
685+
686+
premiumLicense:=func()*coderdenttest.LicenseOptions {
687+
return (&coderdenttest.LicenseOptions{
688+
AccountType:"salesforce",
689+
AccountID:"Charlie",
690+
DeploymentIDs:nil,
691+
Trial:false,
692+
FeatureSet:codersdk.FeatureSetPremium,
693+
AllFeatures:true,
683694
}).Valid(time.Now())
684695
}
685696

@@ -789,6 +800,30 @@ func TestLicenseEntitlements(t *testing.T) {
789800
assert.Equalf(t,int64(50),*userFeature.Actual,"user count")
790801
},
791802
},
803+
{
804+
Name:"EnterpriseDisabledMultiOrg",
805+
Licenses: []*coderdenttest.LicenseOptions{
806+
enterpriseLicense().UserLimit(100),
807+
},
808+
Enablements:defaultEnablements,
809+
Arguments: license.FeatureArguments{},
810+
ExpectedErrorContains:"",
811+
AssertEntitlements:func(t*testing.T,entitlements codersdk.Entitlements) {
812+
assert.False(t,entitlements.Features[codersdk.FeatureMultipleOrganizations].Enabled,"multi-org only enabled for premium")
813+
},
814+
},
815+
{
816+
Name:"PremiumEnabledMultiOrg",
817+
Licenses: []*coderdenttest.LicenseOptions{
818+
premiumLicense().UserLimit(100),
819+
},
820+
Enablements:defaultEnablements,
821+
Arguments: license.FeatureArguments{},
822+
ExpectedErrorContains:"",
823+
AssertEntitlements:func(t*testing.T,entitlements codersdk.Entitlements) {
824+
assert.True(t,entitlements.Features[codersdk.FeatureMultipleOrganizations].Enabled,"multi-org enabled for premium")
825+
},
826+
},
792827
}
793828

794829
for_,tc:=rangetestCases {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp