Entitlement model — product code mapping, tier expansion #619

Open
opened 2026-06-12 07:57:59 +00:00 by jmiller · 1 comment
Owner

Phase 1.3 — Entitlement Model

Parent: #616 | Depends on: #617, #618

models/licensing/entitlement.go:

  • ExpandTier(tierKey) -> []Entitlement — look up product_tier, return list of repo entitlements
  • SetEntitlements(licenseID, tierKey) — delete old, insert new from tier definition
  • HasEntitlement(licenseID, repoName) -> bool — check if license covers a specific repo
  • GetEntitlements(licenseID) -> []Entitlement — list all product codes for a license
  • AddCustomEntitlement(licenseID, productCode, repoName) — for add-on purchases outside tiers

Product code to repo mapping

Each MokoSuite product has a code and a repo:

  • base -> MokoSuite
  • crm -> MokoSuiteCRM
  • erp -> MokoSuiteERP
  • child -> MokoSuiteChild
  • create -> MokoSuiteCreate
  • npo -> MokoSuiteNPO
  • pos -> MokoSuitePOS
  • shop -> MokoSuiteShop
  • hrm -> MokoSuiteHRM
  • mrp -> MokoSuiteMRP
  • restaurant -> MokoSuiteRestaurant

Acceptance criteria

  • Tier expansion correctly maps tier key to full repo list
  • Entitlement check is O(1) with proper indexing
  • Custom entitlements survive tier changes (add-on logic)
  • Entitlements auto-rebuild when tier changes on license
## Phase 1.3 — Entitlement Model Parent: #616 | Depends on: #617, #618 `models/licensing/entitlement.go`: - `ExpandTier(tierKey) -> []Entitlement` — look up product_tier, return list of repo entitlements - `SetEntitlements(licenseID, tierKey)` — delete old, insert new from tier definition - `HasEntitlement(licenseID, repoName) -> bool` — check if license covers a specific repo - `GetEntitlements(licenseID) -> []Entitlement` — list all product codes for a license - `AddCustomEntitlement(licenseID, productCode, repoName)` — for add-on purchases outside tiers ### Product code to repo mapping Each MokoSuite product has a code and a repo: - `base` -> MokoSuite - `crm` -> MokoSuiteCRM - `erp` -> MokoSuiteERP - `child` -> MokoSuiteChild - `create` -> MokoSuiteCreate - `npo` -> MokoSuiteNPO - `pos` -> MokoSuitePOS - `shop` -> MokoSuiteShop - `hrm` -> MokoSuiteHRM - `mrp` -> MokoSuiteMRP - `restaurant` -> MokoSuiteRestaurant ### Acceptance criteria - [ ] Tier expansion correctly maps tier key to full repo list - [ ] Entitlement check is O(1) with proper indexing - [ ] Custom entitlements survive tier changes (add-on logic) - [ ] Entitlements auto-rebuild when tier changes on license
Author
Owner

Branch created: feature/619-entitlement-model-product-code-mapping-t

git fetch origin
git checkout feature/619-entitlement-model-product-code-mapping-t
Branch created: [`feature/619-entitlement-model-product-code-mapping-t`](https://code.mokoconsulting.tech/MokoConsulting/MokoGitea-APP/src/branch/feature/619-entitlement-model-product-code-mapping-t) ```bash git fetch origin git checkout feature/619-entitlement-model-product-code-mapping-t ```
Sign in to join this conversation.