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