code wiki / _hdl_build / nx_authz.nx

nx_authz.nx

buildroot/runtime/_hdl_build/nx_authz.nx

3947 B72 linesdepth 3pulls 3 transitivereach 5 importersview sourcekind librarytopic authz
docsdependenciesstructsconstsfunctions

about

nx_authz.nx -- per-realm PERMISSION LEVELS (authorization), the layer ON TOP of OPAQUE authentication. OPAQUE answers "who are you (valid session) + which realm"; THIS answers "what may THIS user SEE/DO" -- so "all users" do NOT share the same access (operator 2026-06-17: nishifamily nsfw/private not shared by everyone; andelinwest lawyers and clients on different permission levels). Model (data-driven, rule 11): * each realm has a RESOURCE POLICY = parallel arrays (path-prefix, required_level) * each user has a LEVEL within that realm (higher = more access) * authz_level_allow = LONGEST-PREFIX matching rule's required_level <= user's level ? ALLOW : DENY, DENY-BY-DEFAULT (an unlisted resource is denied). Realm-scoped: each realm supplies its OWN policy + user tables, so a nishifamily level never grants an andelinwest resource. Reuses nx_vault_acl (acl_is_prefix -- the same least-privilege longest-prefix primitive; no reinvention). A daemon composes: nx_sa_validate (authn -> handle+realm) -> authz_level_of(handle) -> authz_level_allow(level, resource). For finer per-user/per-record scoping (e.g. client A's case vs B's), use nx_vault_acl acl_eval with a per-user policy; THIS organ is the hierarchical-level common case. license_tier: ORIGINAL

dependencies 2 imports · 5 importers

nx_vault_acl.nx nx_syscalls.nx nx_authz.nx nx_authz_gate.nx nx_authz_session_gate.nx nx_ciq_family_gate.nx nx_gallery_nsfw_gate.nx nx_media_access_gate.nx

imports: nx_vault_acl.nxnx_syscalls.nx

imported by: nx_authz_gate.nxnx_authz_session_gate.nxnx_ciq_family_gate.nxnx_gallery_nsfw_gate.nxnx_media_access_gate.nx

structs

none

consts

17const AUTHZ_DENY: i64 = 0
18const AUTHZ_ALLOW: i64 = 1

functions

23func authz_level_allow(user_level: i64, paths: *i64, lens: *i64, req_levels: *i64, nrules: i64, req: *u8, req_len: i64) -> i64
41func authz_level_of(handle: *u8, h_n: i64, u_handles: *i64, u_hlens: *i64, u_levels: *i64, n: i64) -> i64
called by 3: mainsg_decidemain
60func authz_filter(user_level: i64, items: *i64, item_lens: *i64, n: i64, paths: *i64, lens: *i64, req_levels: *i64, npol: i64, out: *i64) -> i64
called by 3: mainmainmain calls 1: authz_level_allow