MCPcopy Create free account
hub / github.com/bytebase/bytebase / IsFeatureEnabled

Method IsFeatureEnabled

backend/enterprise/license.go:287–298  ·  view source on GitHub ↗

IsFeatureEnabled returns whether a feature is enabled.

(ctx context.Context, workspaceID string, f v1pb.PlanFeature)

Source from the content-addressed store, hash-verified

285
286// IsFeatureEnabled returns whether a feature is enabled.
287func (s *LicenseService) IsFeatureEnabled(ctx context.Context, workspaceID string, f v1pb.PlanFeature) error {
288 plan := s.GetEffectivePlan(ctx, workspaceID)
289 features, ok := planFeatureMatrix[plan]
290 if !ok || !features[f] {
291 minimalPlan := v1pb.PlanType_ENTERPRISE
292 if planFeatureMatrix[v1pb.PlanType_TEAM][f] {
293 minimalPlan = v1pb.PlanType_TEAM
294 }
295 return errors.Errorf("feature %s is a %s feature, please upgrade to access it", f.String(), minimalPlan.String())
296 }
297 return nil
298}
299
300// IsFeatureEnabledForInstance returns whether a feature is enabled for the instance.
301func (s *LicenseService) IsFeatureEnabledForInstance(ctx context.Context, workspaceID string, f v1pb.PlanFeature, instance *store.InstanceMessage) error {

Callers 15

GetAccessTokenDurationFunction · 0.80
GetRefreshTokenDurationFunction · 0.80
CreateDatabaseGroupMethod · 0.80
UpdateDatabaseGroupMethod · 0.80
SearchAuditLogsMethod · 0.80
ExportAuditLogsMethod · 0.80
checkFeatureAvailableMethod · 0.80
getUnlicensedFeaturesMethod · 0.80
AdminExecuteMethod · 0.80

Calls 3

GetEffectivePlanMethod · 0.95
ErrorfMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected