@xeplr/auth 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ -- Which SOLD MODULE each catalog row belongs to.
2
+ --
3
+ -- This is a second, independent axis from the existing *Group columns:
4
+ --
5
+ -- apiGroup / menuGroup / ... = what FUNCTION it is. Roles grant it, and the
6
+ -- CUSTOMER'S admin controls those roles.
7
+ -- licenseModule = which PRODUCT it was sold as. Only Xeplr
8
+ -- writes this, and no role can escape it.
9
+ --
10
+ -- Effective access is the intersection: a company admin holding
11
+ -- 'configuration:view' still cannot see the Warehouse menu if the company is
12
+ -- not licensed for the warehouse module. That matters because Super Admin is
13
+ -- granted every menu by an unfiltered CROSS JOIN (see xeplr-bi's
14
+ -- 0007_warehouse_menu.sql) — so entitlement CANNOT be expressed as a role.
15
+ --
16
+ -- Deliberately not called "service": that word already means "which package
17
+ -- wrote this row" (attachConfig({ service })), and applicationId already means
18
+ -- "which deployment owns it". This is a third thing — which line item on the
19
+ -- price list — and reusing either name would collide with a documented meaning.
20
+ --
21
+ -- Default 'core' on purpose. Login, company selection, the account menu and the
22
+ -- home page belong to no product; if they were tagged 'bi' an unlicensed
23
+ -- company could not even sign in to see that it is unlicensed. Backfilling
24
+ -- everything to 'core' means adding this column changes no behaviour at all
25
+ -- until rows are deliberately re-tagged.
26
+
27
+ ALTER TABLE "apis" ADD COLUMN IF NOT EXISTS "licenseModule" varchar(50) NOT NULL DEFAULT 'core';
28
+ ALTER TABLE "menus" ADD COLUMN IF NOT EXISTS "licenseModule" varchar(50) NOT NULL DEFAULT 'core';
29
+ ALTER TABLE "uiPages" ADD COLUMN IF NOT EXISTS "licenseModule" varchar(50) NOT NULL DEFAULT 'core';
30
+ ALTER TABLE "uiElements" ADD COLUMN IF NOT EXISTS "licenseModule" varchar(50) NOT NULL DEFAULT 'core';
31
+
32
+ CREATE INDEX IF NOT EXISTS "apis_licenseModule_index" ON "apis" ("licenseModule");
33
+ CREATE INDEX IF NOT EXISTS "menus_licenseModule_index" ON "menus" ("licenseModule");
34
+ CREATE INDEX IF NOT EXISTS "uiPages_licenseModule_index" ON "uiPages" ("licenseModule");
35
+ CREATE INDEX IF NOT EXISTS "uiElements_licenseModule_index" ON "uiElements" ("licenseModule");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeplr/auth",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Pluggable authentication service: register, login, forgot/reset password, RBAC, multi-tenancy",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -48,5 +48,8 @@
48
48
  },
49
49
  "peerDependencies": {
50
50
  "express": "^4.0.0 || ^5.0.0"
51
+ },
52
+ "scripts": {
53
+ "test": "node --test test/*.test.js"
51
54
  }
52
55
  }