code wiki / (root) / nx_crm_acl.nx

nx_crm_acl.nx

buildroot/runtime/nx_crm_acl.nx

8196 B153 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic crm
docsdependenciesstructsconstsfunctions

about

nx_crm_acl.nx -- USERS + ROLES + RECORD PERMISSIONS (CRM census E7). The Salesforce-verified layered model, sovereign + integer-deterministic + DENY-BY-DEFAULT: 1. TENANT WALL first: cross-workspace access is ALWAYS denied -- even for admins (the andelinwest isolation law). 2. OWNER: full access to own records. 3. ADMIN (role 4): full access within the tenant. 4. ORG-WIDE DEFAULT per record: private(0) | read(1) | write(2). 5. ROLE HIERARCHY: the management chain ABOVE the owner gets READ on private records (v1 conservative; Salesforce grants owner-like via hierarchy -- we start read-only, stated). 6. EXPLICIT SHARES: (record, user, level) grants, level >= action required. 7. FIELD-LEVEL SECURITY: sensitive fields (e.g. giving amounts) need a minimum role. Pure logic + selftest gate (argless): a 14-check allow/deny matrix incl. the tenant-beats-admin proof. Persistence rides the relate store next. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_crm_acl.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main p sys_write slen sys_mmap ac_check p ↻ ac_can ac_ufind seq seq ↻ ac_above ac_ufind ↻ seq ↻ ac_field ac_ufind ↻

structs

none

consts

none

functions

15func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: p
16func p(s: *u8) -> i64 { sys_write(1, s, slen(s)); return 0 }
called by 3: pnac_checkmain calls 2: sys_writeslen
17func pn(v: i64) -> i64
23func seq(a: *u8, b: *u8) -> i64
33func ac_ufind(un: *i64, n: i64, name: *u8) -> i64
called by 3: ac_aboveac_canac_field calls 1: seq
39func ac_above(un: *i64, um: *i64, n: i64, owner: *u8, user: *u8) -> i64
called by 1: ac_can calls 2: ac_ufindseq
54func ac_can(ctx: *i64, user: *u8, action: i64, rec: *i64) -> i64
called by 1: main calls 3: ac_ufindseqac_above
86func ac_field(ctx: *i64, user: *u8, minrole: i64) -> i64
called by 1: main calls 1: ac_ufind
94func ac_check(label: *u8, got: i64, want: i64) -> i64
called by 1: main calls 1: p
102func main() -> i64