Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: update the seat limit (#4363)
ecmadao38c15b030d4e
diff --git a/api/plan.go b/api/plan.goindex 3bda933faf..8c1e04fd29 100644--- a/api/plan.go+++ b/api/plan.go@@ -255,6 +255,7 @@ type PlanPatch struct {type TrialPlanCreate struct {Type PlanType `jsonapi:"attr,type"`Days int `jsonapi:"attr,days"`+ Seat int `jsonapi:"attr,seat"`InstanceCount int `jsonapi:"attr,instanceCount"`}diff --git a/enterprise/api/license.go b/enterprise/api/license.goindex f6ba465df5..e6d73d1c58 100644--- a/enterprise/api/license.go+++ b/enterprise/api/license.go@@ -23,7 +23,7 @@ type License struct {InstanceCount int `json:"instanceCount"`ExpiresTs int64 `json:"expiresTs"`IssuedTs int64 `json:"issuedTs"`- Seat int64 `json:"seat"`+ Seat int `json:"seat"`Plan api.PlanType `json:"plan"`Trialing bool `json:"trialing"`OrgName string `json:"orgName"`diff --git a/enterprise/service/license.go b/enterprise/service/license.goindex bed104a249..0bb4696f2c 100644--- a/enterprise/service/license.go+++ b/enterprise/service/license.go@@ -29,6 +29,7 @@ type LicenseService struct {// Claims creates a struct that will be encoded to a JWT.// We add jwt.RegisteredClaims as an embedded type, to provide fields such as name.type Claims struct {+ Seat int `json:"seat"`InstanceCount int `json:"instanceCount"`Trialing bool `json:"trialing"`Plan string `json:"plan"`@@ -82,12 +83,18 @@ func (s *LicenseService) LoadSubscription(ctx context.Context) enterpriseAPI.Subreturn enterpriseAPI.Subscription{Plan: api.FREE,// -1 means not expire, just for free plan- ExpiresTs: -1,- InstanceCount: 5,+ ExpiresTs: -1,+ // -1 means no limit for instance count.+ InstanceCount: -1,Seat: config.SeatForFreePlan,}}+ seat := license.Seat+ if seat == 0 {+ seat = -1+ }+// Cache the subscription.s.cachedSubscription = &enterpriseAPI.Subscription{Plan: license.Plan,@@ -97,8 +104,7 @@ func (s *LicenseService) LoadSubscription(ctx context.Context) enterpriseAPI.SubTrialing: license.Trialing,OrgID: license.OrgID(),OrgName: license.OrgName,- // TODO(ed): support seat limit.- Seat: -1,+ Seat: seat,}return *s.cachedSubscription}@@ -242,12 +248,14 @@ func (s *LicenseService) parseClaims(claims *Claims) (*enterpriseAPI.License, erlicense := &enterpriseAPI.License{InstanceCount: instanceCount,- ExpiresTs: claims.ExpiresAt.Unix(),- IssuedTs: claims.IssuedAt.Unix(),- Plan: planType,- Subject: claims.Subject,- Trialing: claims.Trialing,- OrgName: claims.OrgName,+ // TODO(ed): validate the seat in claim.+ Seat: claims.Seat,+ ExpiresTs: claims.ExpiresAt.Unix(),+ IssuedTs: claims.IssuedAt.Unix(),+ Plan: planType,+ Subject: claims.Subject,+ Trialing: claims.Trialing,+ OrgName: claims.OrgName,}if err := license.Valid(); err != nil {diff --git a/frontend/src/components/PricingTable/PricingTable.vue b/frontend/src/components/PricingTable/PricingTable.vueindex 9ead08faae..9f7dfb5f0b 100644--- a/frontend/src/components/PricingTable/PricingTable.vue+++ b/frontend/src/components/PricingTable/PricingTable.vue@@ -42,7 +42,7 @@</p><div class="text-gray-400">- {{ plan.priceInfo }}+ {{ $t(`subscription.${plan.title}-price-intro`) }}</div><button@@ -165,7 +165,7 @@</p><div class="text-gray-400">- {{ plan.priceInfo }}+ {{ $t(`subscription.${plan.title}-price-intro`) }}</div><button@@ -296,7 +296,6 @@ const plans = computed((): LocalPlan[] => {: `$${plan.pricePerSeatPerMonth}`,priceUnit:plan.type === PlanType.ENTERPRISE ? "" : t("subscription.per-month"),- priceInfo: t(`subscription.${plan.title}-price-intro`),}));});diff --git a/frontend/src/components/PricingTable/types.ts b/frontend/src/components/PricingTable/types.tsindex 92f7a4297d..fafff7c5e1 100644--- a/frontend/src/components/PricingTable/types.ts+++ b/frontend/src/components/PricingTable/types.ts@@ -9,5 +9,4 @@ export interface LocalPlan extends Plan {isAvailable: boolean;pricing: string;priceUnit: string;- priceInfo: string;}diff --git a/frontend/src/locales/subscription/en-US.json b/frontend/src/locales/subscription/en-US.jsonindex dea138fef6..f34c64c537 100644--- a/frontend/src/locales/subscription/en-US.json+++ b/frontend/src/locales/subscription/en-US.json@@ -1,7 +1,7 @@{"current": "Current plan","seat-count": "Seat count",- "seat-unlimited": "Unlimited",+ "unlimited": "Unlimited","instance-count": "Instance count","expires-at": "Expires at","free-trial": "You can start a free trial for 14 days - no credit card required",@@ -14,9 +14,10 @@"price-unit-for-enterprise": "/ month","start-from": "Start from","billed-annually": "Billed annually",+ "billed-monthly": "Billed monthly","per-instance": "Per instance","free-price-intro": "Up to 2 seats",- "team-price-intro": "Per seat, billed annually",+ "team-price-intro": "Per seat, billed monthly","enterprise-price-intro": "Customized, billed annually","deploy": "Deploy","contact-us": "Contact us",diff --git a/frontend/src/locales/subscription/zh-CN.json b/frontend/src/locales/subscription/zh-CN.jsonindex 30de036136..e4cad0b8a3 100644--- a/frontend/src/locales/subscription/zh-CN.json+++ b/frontend/src/locales/subscription/zh-CN.json@@ -1,7 +1,7 @@{"current": "当前版本","seat-count": "席位数",- "seat-unlimited": "无限制",+ "unlimited": "无限制","instance-count": "实例数","expires-at": "过期时间","free-trial": "您可以免费试用 14 天 - 无需信用卡或预付费",@@ -14,9 +14,10 @@"price-unit-for-enterprise": "/ 月起","start-from": "","billed-annually": "按年付费",+ "billed-monthly": "按月付费","per-instance": "每个实例","free-price-intro": "最多 2 个席位",- "team-price-intro": "根据席位数量按年付费",+ "team-price-intro": "根据席位数量按月付费","enterprise-price-intro": "自定义席位和实例,按年付费","deploy": "部署","contact-us": "联系我们",diff --git a/frontend/src/store/modules/subscription.ts b/frontend/src/store/modules/subscription.tsindex 1689a21655..3663a7ce66 100644--- a/frontend/src/store/modules/subscription.ts+++ b/frontend/src/store/modules/subscription.ts@@ -14,7 +14,6 @@ export const useSubscriptionStore = defineStore("subscription", {state: (): SubscriptionState => ({subscription: undefined,trialingDays: 14,- trialingInstanceCount: 999,}),getters: {currentPlan(state): PlanType {@@ -130,7 +129,8 @@ export const useSubscriptionStore = defineStore("subscription", {attributes: {type: planType,days: this.trialingDays,- instanceCount: this.trialingInstanceCount,+ seat: 10,+ instanceCount: -1,},},})diff --git a/frontend/src/types/plan.yaml b/frontend/src/types/plan.yamlindex ee48ddaf8c..1a841212f1 100644--- a/frontend/src/types/plan.yaml+++ b/frontend/src/types/plan.yaml@@ -44,7 +44,9 @@ planList:trialDays: 0unitPrice: 0trialPrice: 0- freeInstanceCount: 1+ freeInstanceCount: -1+ freeSeatCount: 2+ maximumSeatCount: 2pricePerSeatPerMonth: 0featureList:- type: instance-count@@ -91,9 +93,11 @@ planList:- type: 1title: teamtrialDays: 14- unitPrice: 1740+ unitPrice: 29trialPrice: 0- freeInstanceCount: 5+ freeInstanceCount: -1+ freeSeatCount: 1+ maximumSeatCount: 10pricePerSeatPerMonth: 29featureList:- type: instance-count@@ -147,10 +151,12 @@ planList:- type: 2title: enterprisetrialDays: 0- unitPrice: 0+ unitPrice: 90trialPrice: 0- freeInstanceCount: 5- pricePerSeatPerMonth: 199+ freeInstanceCount: -1+ freeSeatCount: 1+ maximumSeatCount: -1+ pricePerSeatPerMonth: 90featureList:- type: instance-countcontent: instance-customizeddiff --git a/frontend/src/types/subscription.ts b/frontend/src/types/subscription.tsindex 168f444815..483f44f6c5 100644--- a/frontend/src/types/subscription.ts+++ b/frontend/src/types/subscription.ts@@ -12,5 +12,4 @@ export interface Subscription {export interface SubscriptionState {subscription: Subscription | undefined;trialingDays: number;- trialingInstanceCount: number;}diff --git a/frontend/src/views/SettingWorkspaceSubscription.vue b/frontend/src/views/SettingWorkspaceSubscription.vueindex 2dc17f7b6c..db856398fd 100644--- a/frontend/src/views/SettingWorkspaceSubscription.vue+++ b/frontend/src/views/SettingWorkspaceSubscription.vue@@ -159,8 +159,12 @@ export default defineComponent({const { subscription, expireAt, isTrialing, isExpired } =storeToRefs(subscriptionStore);- const instanceCount = computed((): number => {- return subscription.value?.instanceCount ?? 5;+ const instanceCount = computed((): string => {+ const count = subscription.value?.instanceCount ?? 5;+ if (count > 0) {+ return `${count}`;+ }+ return t("subscription.unlimited");});const seatCount = computed((): string => {@@ -168,7 +172,7 @@ export default defineComponent({if (seat > 0) {return `${seat}`;}- return t("subscription.seat-unlimited");+ return t("subscription.unlimited");});const currentPlan = computed((): string => {diff --git a/server/instance.go b/server/instance.goindex 2629abaf57..633a11b65e 100644--- a/server/instance.go+++ b/server/instance.go@@ -519,11 +519,15 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {// instanceCountGuard is a feature guard for instance count.// We only count instances with NORMAL status since users cannot make any operations for ARCHIVED one.func (s *Server) instanceCountGuard(ctx context.Context) error {+ subscription := s.licenseService.LoadSubscription(ctx)+ if subscription.InstanceCount == -1 {+ return nil+ }+count, err := s.store.CountInstance(ctx, &store.CountInstanceMessage{})if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to count instance").SetInternal(err)}- subscription := s.licenseService.LoadSubscription(ctx)if count >= subscription.InstanceCount {return echo.NewHTTPError(http.StatusForbidden, fmt.Sprintf("You have reached the maximum instance count %d.", subscription.InstanceCount))}diff --git a/server/subscription.go b/server/subscription.goindex e297d44a0a..a208b3fb53 100644--- a/server/subscription.go+++ b/server/subscription.go@@ -59,6 +59,7 @@ func (s *Server) registerSubscriptionRoutes(g *echo.Group) {}license := &enterpriseAPI.License{InstanceCount: create.InstanceCount,+ Seat: create.Seat,ExpiresTs: time.Now().AddDate(0, 0, create.Days).Unix(),IssuedTs: time.Now().Unix(),Plan: create.Type,