fix(shared): link-field where query must use (customer.Id,eq,N) not (customer,eq,N)

- calculateEffectiveGrants queried CustomerProducts/AccessGrants with
  (customer,eq,N), which matches the link field's DISPLAY NAME and always
  returns 0 rows -> desiredPaths always [] -> W1/W2/W3 write empty scopes.
- Regression from the shared-lib refactor (3ecee30): W2 had already fixed
  this in 36a6b3b but the shared extract reverted to the old syntax.
- Correct syntax (customer.Id,eq,N) verified against live NocoDB for
  customer 6 -> /Class/Health, /Class/Other, /Template/Music.
- Updated all three test mocks to match the corrected where clause.
This commit is contained in:
2026-08-23 06:55:04 +08:00
parent 9bcdfc2049
commit 21e3a3b45f
7 changed files with 14 additions and 11 deletions
+2 -2
View File
@@ -54,9 +54,9 @@ sandbox.helpers = {
if (u.endsWith('/api/auth/login')) return { data: { token: 'ADMIN_TOKEN' } };
if (u.includes('/tr/records?limit=10000')) return { list: RESOURCES };
if (u.includes('/tc/records?limit=10000')) return { list: CUSTOMERS };
const cpm = u.match(/tcpc\/records\?where=\(customer,eq,(\d+)\)/);
const cpm = u.match(/tcpc\/records\?where=\(customer\.Id,eq,(\d+)\)/);
if (cpm) return { list: CPS[Number(cpm[1])] || [] };
const gm = u.match(/tag\/records\?where=\(customer,eq,(\d+)\)/);
const gm = u.match(/tag\/records\?where=\(customer\.Id,eq,(\d+)\)/);
if (gm) return { list: GRANTS[Number(gm[1])] || [] };
const pm = u.match(/tp\/links\/lnk\/records\/(\d+)/);
if (pm) return { list: PRODUCT_RES[Number(pm[1])] || [] };