chore: tweak feature matrix

This commit is contained in:
johnnyjoy 2024-08-21 20:02:17 +08:00
parent 85adb885fe
commit e3c2dc8441

View File

@ -35,12 +35,12 @@ func (f FeatureType) String() string {
// FeatureMatrix is a matrix of features in [Free, Pro, Enterprise]. // FeatureMatrix is a matrix of features in [Free, Pro, Enterprise].
var FeatureMatrix = map[FeatureType][3]bool{ var FeatureMatrix = map[FeatureType][3]bool{
FeatureTypeSSO: {false, false, false}, FeatureTypeUnlimitedAccounts: {false, true, true},
FeatureTypeAdvancedAnalytics: {false, false, false},
FeatureTypeUnlimitedAccounts: {false, true, false},
FeatureTypeUnlimitedShortcuts: {false, true, true}, FeatureTypeUnlimitedShortcuts: {false, true, true},
FeatureTypeUnlimitedCollections: {false, true, true}, FeatureTypeUnlimitedCollections: {false, true, true},
FeatureTypeCustomeBranding: {false, true, true}, FeatureTypeCustomeBranding: {false, false, true},
FeatureTypeSSO: {false, false, false},
FeatureTypeAdvancedAnalytics: {false, false, false},
} }
func getDefaultFeatures(plan v1pb.PlanType) []FeatureType { func getDefaultFeatures(plan v1pb.PlanType) []FeatureType {
@ -55,10 +55,6 @@ func getDefaultFeatures(plan v1pb.PlanType) []FeatureType {
func validateFeatureString(feature string) (FeatureType, bool) { func validateFeatureString(feature string) (FeatureType, bool) {
switch feature { switch feature {
case "ysh.slash.sso":
return FeatureTypeSSO, true
case "ysh.slash.advanced-analytics":
return FeatureTypeAdvancedAnalytics, true
case "ysh.slash.unlimited-accounts": case "ysh.slash.unlimited-accounts":
return FeatureTypeUnlimitedAccounts, true return FeatureTypeUnlimitedAccounts, true
case "ysh.slash.unlimited-shortcuts": case "ysh.slash.unlimited-shortcuts":
@ -67,6 +63,10 @@ func validateFeatureString(feature string) (FeatureType, bool) {
return FeatureTypeUnlimitedCollections, true return FeatureTypeUnlimitedCollections, true
case "ysh.slash.custom-branding": case "ysh.slash.custom-branding":
return FeatureTypeCustomeBranding, true return FeatureTypeCustomeBranding, true
case "ysh.slash.sso":
return FeatureTypeSSO, true
case "ysh.slash.advanced-analytics":
return FeatureTypeAdvancedAnalytics, true
default: default:
return "", false return "", false
} }