|
8 | 8 | "net/http"
|
9 | 9 | "os"
|
10 | 10 | "path/filepath"
|
| 11 | + "slices" |
11 | 12 | "strconv"
|
12 | 13 | "strings"
|
13 | 14 | "time"
|
@@ -143,26 +144,23 @@ const (
|
143 | 144 | func (set FeatureSet) Features() []FeatureName {
|
144 | 145 | switch FeatureSet(strings.ToLower(string(set))) {
|
145 | 146 | case FeatureSetEnterprise:
|
146 |
| - // List all features that should be included in the Enterprise feature set. |
147 |
| - return []FeatureName{ |
148 |
| - FeatureUserLimit, |
149 |
| - FeatureAuditLog, |
150 |
| - FeatureBrowserOnly, |
151 |
| - FeatureSCIM, |
152 |
| - FeatureTemplateRBAC, |
153 |
| - FeatureHighAvailability, |
154 |
| - FeatureMultipleExternalAuth, |
155 |
| - FeatureExternalProvisionerDaemons, |
156 |
| - FeatureAppearance, |
157 |
| - FeatureAdvancedTemplateScheduling, |
158 |
| - FeatureWorkspaceProxy, |
159 |
| - FeatureUserRoleManagement, |
160 |
| - FeatureExternalTokenEncryption, |
161 |
| - FeatureWorkspaceBatchActions, |
162 |
| - FeatureAccessControl, |
163 |
| - FeatureControlSharedPorts, |
164 |
| - FeatureCustomRoles, |
165 |
| - } |
| 147 | + // Enterprise is the set 'AllFeatures' minus some select features. |
| 148 | + |
| 149 | + // Copy the list of all features |
| 150 | + enterpriseFeatures := make([]FeatureName, len(FeatureNames)) |
| 151 | + copy(enterpriseFeatures, FeatureNames) |
| 152 | + // Remove the selection |
| 153 | + enterpriseFeatures = slices.DeleteFunc(enterpriseFeatures, func(f FeatureName) bool { |
| 154 | + switch f { |
| 155 | + // Add all features that should be excluded in the Enterprise feature set. |
| 156 | + case FeatureMultipleOrganizations: |
| 157 | + return true |
| 158 | + default: |
| 159 | + return false |
| 160 | + } |
| 161 | + }) |
| 162 | + |
| 163 | + return enterpriseFeatures |
166 | 164 | case FeatureSetPremium:
|
167 | 165 | // FeatureSetPremium is a superset of Enterprise
|
168 | 166 | return append(FeatureSetEnterprise.Features(), FeatureMultipleOrganizations)
|
|
0 commit comments