From 77ab56dbf83c43624ca881266c0d9caf3fe7f876 Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Sun, 11 Nov 2018 16:54:36 +0000 Subject: [PATCH] Tweaked app subscription logic --- domain/product.go | 5 +++++ server/middleware.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/domain/product.go b/domain/product.go index fe2c1fdd..4b4e4229 100644 --- a/domain/product.go +++ b/domain/product.go @@ -119,6 +119,11 @@ func (p *Product) IsValid(ctx RequestContext) bool { if time.Now().UTC().Before(ctx.Subscription.End) && uc <= int(ctx.Subscription.Seats) { return true } + } else { + // First 10 is free for Enterprise edition. + if Seats1 == ctx.Subscription.Seats && time.Now().UTC().Before(ctx.Subscription.End) { + return true + } } return false diff --git a/server/middleware.go b/server/middleware.go index 2d90876f..a52e5121 100644 --- a/server/middleware.go +++ b/server/middleware.go @@ -169,7 +169,7 @@ func (m *middleware) Authorize(w http.ResponseWriter, r *http.Request, next http } } - // Tag all HTTP calls with subscription statu + // Tag all HTTP calls with subscription status subs := "false" if m.Runtime.Product.IsValid(rc) { subs = "true"