Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/routes_admin.py +61 -15
- api/routes_query.py +11 -3
- platform/core/perms.py +30 -0
- platform/core/registry.py +1 -1
- web/src/settings/ModulePermsList.tsx +5 -2
- web/src/settings/permsModel.ts +10 -5
RELEASES.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v29",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "caf2c2e",
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v29",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
caf2c2e
|
api/routes_admin.py
CHANGED
|
@@ -81,7 +81,7 @@ def _registry():
|
|
| 81 |
return reg
|
| 82 |
|
| 83 |
|
| 84 |
-
def _view(uname, rec, governed=None, st=None):
|
| 85 |
"""What an administrator may see about an account. NEVER `salt` or `hash` β this function is
|
| 86 |
the only projection these routes use, so there is one place that can leak and it does not.
|
| 87 |
|
|
@@ -105,11 +105,12 @@ def _view(uname, rec, governed=None, st=None):
|
|
| 105 |
# S3 ask 4 β one sentence for the roster's Access column, so the list does not need
|
| 106 |
# a /perms round trip per row to fill one cell. Computed from the same record the
|
| 107 |
# editor will open, so the two cannot disagree.
|
| 108 |
-
"accessSummary": _access_summary(rec, uname=uname, governed=governed, st=st
|
|
|
|
| 109 |
"perms_v": int(rec.get("perms_v") or 0)}
|
| 110 |
|
| 111 |
|
| 112 |
-
def _access_summary(rec, uname="", governed=None, st=None):
|
| 113 |
"""One sentence describing what this account may reach. Deliberately says LESS than the
|
| 114 |
editor: it is a signpost, not a rule listing, and a summary that tried to spell out filters
|
| 115 |
would be wrong the moment a filter got interesting.
|
|
@@ -143,7 +144,17 @@ def _access_summary(rec, uname="", governed=None, st=None):
|
|
| 143 |
entries = (rec.get("perms") or {})
|
| 144 |
if governed:
|
| 145 |
principal = users._public(uname, rec) if uname else rec
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
else:
|
| 148 |
opened = [k for k, e in entries.items() if isinstance(e, dict) and e.get("access", True)]
|
| 149 |
restricted = sum(1 for k in opened
|
|
@@ -250,13 +261,16 @@ def list_users(session: Session = Depends(admin_gate)):
|
|
| 250 |
# `_access_summary` can agree with the editor without paying a document copy per question.
|
| 251 |
import core.user_tables as _ut
|
| 252 |
try:
|
| 253 |
-
|
|
|
|
|
|
|
| 254 |
lent = _ut.lend_defs(session.runtime)
|
| 255 |
except Exception: # noqa: BLE001
|
| 256 |
# A store that cannot list the tenant's databases must not take the roster down. The
|
| 257 |
# summary degrades to the stored-entry reading, which is what it always was.
|
| 258 |
-
governed, lent = None, None
|
| 259 |
-
return {"users": [_view(u, reg[u], governed=governed, st=lent
|
|
|
|
| 260 |
if _tenant_of(reg[u]) == mine]}
|
| 261 |
|
| 262 |
|
|
@@ -434,7 +448,7 @@ def _governable_catalogue():
|
|
| 434 |
_PERM_MODULES = tuple(m["key"] for m in _governable_catalogue())
|
| 435 |
|
| 436 |
|
| 437 |
-
def _perm_modules(session):
|
| 438 |
"""The databases THIS tenant's permission editor governs: `[{key, label, enforced}]`.
|
| 439 |
|
| 440 |
Three inputs, none of them a literal: the topic catalogue above, the tenant's provisioned
|
|
@@ -457,8 +471,23 @@ def _perm_modules(session):
|
|
| 457 |
# A store that cannot list the tenant's databases must not take the whole editor down β
|
| 458 |
# the topic half is still administrable, and an empty `ut_*` half is visibly empty.
|
| 459 |
ut = ()
|
| 460 |
-
|
| 461 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 462 |
|
| 463 |
|
| 464 |
#: β `_enforced_keys` IS DELETED (W36-T22 / CONTRACT C2). It asked `perms.enforced_module_keys`
|
|
@@ -512,6 +541,13 @@ def _module_fields(key, session=None):
|
|
| 512 |
"""
|
| 513 |
import aios_grid
|
| 514 |
key = str(key or "")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 515 |
if key.startswith("ut_"):
|
| 516 |
if session is None:
|
| 517 |
raise err(400, "ungoverned_module",
|
|
@@ -959,7 +995,7 @@ def get_perms(username: str, session: Session = Depends(admin_gate)):
|
|
| 959 |
# nurilab or gtmlab admin opened Manage user and saw Royal Imports' Customer and Product
|
| 960 |
# databases. `_perm_modules` applies the tenant's own provisioning (the rule `routes_nav`
|
| 961 |
# has applied since wave 18) and merges the tenant's own `ut_*` databases.
|
| 962 |
-
modules = _perm_modules(session)
|
| 963 |
# ββ W36-T22 / C2 β EVERY listed database, not an `enforced` subset of them. See
|
| 964 |
# `perms.tenant_governable_modules` for why the flag is deleted rather than defaulted.
|
| 965 |
governed = [m["key"] for m in modules]
|
|
@@ -983,10 +1019,20 @@ def get_perms(username: str, session: Session = Depends(admin_gate)):
|
|
| 983 |
# `users.json` and does not carry one INSIDE it, so `may_read` would hand `may_open` a
|
| 984 |
# `None` viewer and get a fail-closed False β the very outage this line exists to prevent,
|
| 985 |
# arriving through the fix for it. The same trap cost a gate double an hour earlier today.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 986 |
perms_out[k] = e if isinstance(e, dict) else {
|
| 987 |
-
"access": bool(
|
| 988 |
-
st=session.runtime)),
|
| 989 |
-
"filter": None, "hiddenFields": []}
|
| 990 |
return {"username": uname,
|
| 991 |
"perms": perms_out,
|
| 992 |
# S3 ask 2 β the marker rides the GET. An absent module entry means DENY on a
|
|
@@ -1042,7 +1088,7 @@ def put_perms(username: str, body: dict = Body(default=None),
|
|
| 1042 |
raise err(400, "self_perms",
|
| 1043 |
"you cannot set permissions on your own account β ask another admin")
|
| 1044 |
|
| 1045 |
-
_mods = _perm_modules(session)
|
| 1046 |
# ββ W36-T22 / C2 β ONE key set. It was two ("listed" and "enforced") with a refusal in the
|
| 1047 |
# gap; W36-T21 closed the gap, so every database the editor shows is one whose wall the table
|
| 1048 |
# routes apply. `session` rides so a `ut_*` schema can be read for THIS tenant.
|
|
|
|
| 81 |
return reg
|
| 82 |
|
| 83 |
|
| 84 |
+
def _view(uname, rec, governed=None, st=None, surface_keys=None):
|
| 85 |
"""What an administrator may see about an account. NEVER `salt` or `hash` β this function is
|
| 86 |
the only projection these routes use, so there is one place that can leak and it does not.
|
| 87 |
|
|
|
|
| 105 |
# S3 ask 4 β one sentence for the roster's Access column, so the list does not need
|
| 106 |
# a /perms round trip per row to fill one cell. Computed from the same record the
|
| 107 |
# editor will open, so the two cannot disagree.
|
| 108 |
+
"accessSummary": _access_summary(rec, uname=uname, governed=governed, st=st,
|
| 109 |
+
surface_keys=surface_keys),
|
| 110 |
"perms_v": int(rec.get("perms_v") or 0)}
|
| 111 |
|
| 112 |
|
| 113 |
+
def _access_summary(rec, uname="", governed=None, st=None, surface_keys=None):
|
| 114 |
"""One sentence describing what this account may reach. Deliberately says LESS than the
|
| 115 |
editor: it is a signpost, not a rule listing, and a summary that tried to spell out filters
|
| 116 |
would be wrong the moment a filter got interesting.
|
|
|
|
| 144 |
entries = (rec.get("perms") or {})
|
| 145 |
if governed:
|
| 146 |
principal = users._public(uname, rec) if uname else rec
|
| 147 |
+
# β PER KIND, MIRRORING `get_perms`' OWN DEFAULTS β the first draft asked
|
| 148 |
+
# `nav_may_open` for EVERY key and that was a second idea of the count: for a migrated
|
| 149 |
+
# record with no topic entry the editor's default is `may_read` (DENY), so a blanket
|
| 150 |
+
# admission read would make the roster say "3 modules" about an account whose editor
|
| 151 |
+
# shows one box ticked. The roster's whole contract (leg 6 of the T22 section) is that
|
| 152 |
+
# it counts what the editor would show; a SURFACE key defaults from admission there,
|
| 153 |
+
# everything else from `may_read`, so this does exactly the same, key by key.
|
| 154 |
+
opened = [k for k in governed
|
| 155 |
+
if (perm_scope.nav_may_open(principal, k, st=st)
|
| 156 |
+
if k in (surface_keys or ()) else
|
| 157 |
+
perm_scope.may_read(principal, k, st=st))]
|
| 158 |
else:
|
| 159 |
opened = [k for k, e in entries.items() if isinstance(e, dict) and e.get("access", True)]
|
| 160 |
restricted = sum(1 for k in opened
|
|
|
|
| 261 |
# `_access_summary` can agree with the editor without paying a document copy per question.
|
| 262 |
import core.user_tables as _ut
|
| 263 |
try:
|
| 264 |
+
_rows = _perm_modules(session, surfaces=True)
|
| 265 |
+
governed = [m["key"] for m in _rows]
|
| 266 |
+
surface_keys = {m["key"] for m in _rows if m.get("surface")}
|
| 267 |
lent = _ut.lend_defs(session.runtime)
|
| 268 |
except Exception: # noqa: BLE001
|
| 269 |
# A store that cannot list the tenant's databases must not take the roster down. The
|
| 270 |
# summary degrades to the stored-entry reading, which is what it always was.
|
| 271 |
+
governed, lent, surface_keys = None, None, None
|
| 272 |
+
return {"users": [_view(u, reg[u], governed=governed, st=lent, surface_keys=surface_keys)
|
| 273 |
+
for u in sorted(reg)
|
| 274 |
if _tenant_of(reg[u]) == mine]}
|
| 275 |
|
| 276 |
|
|
|
|
| 448 |
_PERM_MODULES = tuple(m["key"] for m in _governable_catalogue())
|
| 449 |
|
| 450 |
|
| 451 |
+
def _perm_modules(session, surfaces=False):
|
| 452 |
"""The databases THIS tenant's permission editor governs: `[{key, label, enforced}]`.
|
| 453 |
|
| 454 |
Three inputs, none of them a literal: the topic catalogue above, the tenant's provisioned
|
|
|
|
| 471 |
# A store that cannot list the tenant's databases must not take the whole editor down β
|
| 472 |
# the topic half is still administrable, and an empty `ut_*` half is visibly empty.
|
| 473 |
ut = ()
|
| 474 |
+
cat = _governable_catalogue()
|
| 475 |
+
skeys = set()
|
| 476 |
+
if surfaces:
|
| 477 |
+
# ββ OWNER RULING 2026-08-18 β the Assistant and Agents surfaces are
|
| 478 |
+
# governable ACCESS toggles in the ACCOUNT editor. `surfaces` is caller-explicit and
|
| 479 |
+
# defaults CLOSED because the other consumer of this list is the CHANNEL-AGENT editor
|
| 480 |
+
# (`routes_slack.get_channel_agent`), whose principal is enforced per DATABASE
|
| 481 |
+
# (`agent_rows`/`agent_may_read`) and never opens an app surface: an Assistant toggle
|
| 482 |
+
# there would be a stored rule nothing applies, the exact class C2 deleted.
|
| 483 |
+
surf = _perms.governable_surface_modules()
|
| 484 |
+
skeys = {s["key"] for s in surf}
|
| 485 |
+
cat = cat + surf
|
| 486 |
+
rows = _perms.tenant_governable_modules(session.runtime, cat, ut_entries=ut)
|
| 487 |
+
# The marker survives OUTSIDE `tenant_governable_modules`, which builds bare {key,label}
|
| 488 |
+
# rows: the client needs it only to choose the schemaless help copy, and the server needs
|
| 489 |
+
# it only to pick the admission default in `get_perms`.
|
| 490 |
+
return [dict(r, surface=True) if r["key"] in skeys else r for r in rows]
|
| 491 |
|
| 492 |
|
| 493 |
#: β `_enforced_keys` IS DELETED (W36-T22 / CONTRACT C2). It asked `perms.enforced_module_keys`
|
|
|
|
| 541 |
"""
|
| 542 |
import aios_grid
|
| 543 |
key = str(key or "")
|
| 544 |
+
if key in {s["key"] for s in perms.governable_surface_modules()}:
|
| 545 |
+
# β A SURFACE (Assistant, Agents) has NO field schema, and `[]` is the honest
|
| 546 |
+
# answer rather than the wave-26 empty-option trap: the editor's schemaless rendering
|
| 547 |
+
# is a deliberate state (access toggle only, R9), and `_clean_perms` refuses any
|
| 548 |
+
# filter or hiddenFields validated against this empty vocabulary. An unknown key
|
| 549 |
+
# still RAISES below β this arm admits exactly the derived surface list.
|
| 550 |
+
return []
|
| 551 |
if key.startswith("ut_"):
|
| 552 |
if session is None:
|
| 553 |
raise err(400, "ungoverned_module",
|
|
|
|
| 995 |
# nurilab or gtmlab admin opened Manage user and saw Royal Imports' Customer and Product
|
| 996 |
# databases. `_perm_modules` applies the tenant's own provisioning (the rule `routes_nav`
|
| 997 |
# has applied since wave 18) and merges the tenant's own `ut_*` databases.
|
| 998 |
+
modules = _perm_modules(session, surfaces=True)
|
| 999 |
# ββ W36-T22 / C2 β EVERY listed database, not an `enforced` subset of them. See
|
| 1000 |
# `perms.tenant_governable_modules` for why the flag is deleted rather than defaulted.
|
| 1001 |
governed = [m["key"] for m in modules]
|
|
|
|
| 1019 |
# `users.json` and does not carry one INSIDE it, so `may_read` would hand `may_open` a
|
| 1020 |
# `None` viewer and get a fail-closed False β the very outage this line exists to prevent,
|
| 1021 |
# arriving through the fix for it. The same trap cost a gate double an hour earlier today.
|
| 1022 |
+
# ββ A SURFACE KEY DEFAULTS FROM `nav_may_open`, NOT `may_read`, AND THE
|
| 1023 |
+
# DIFFERENCE IS A MASS REVOCATION. `may_read` on a non-`ut_` key falls through to
|
| 1024 |
+
# `may_access`, which reads migrated-and-undeclared as DENY β correct for a topic
|
| 1025 |
+
# (every save writes topic entries) and false for a surface, because NO surface entry
|
| 1026 |
+
# was storable before 2026-08-18, so every migrated account carries none. The editor
|
| 1027 |
+
# would paint Assistant unchecked for an account that opens it every day, and the next
|
| 1028 |
+
# save of ANY unrelated change would write the explicit deny for real. `nav_may_open`
|
| 1029 |
+
# is the evaluator the nav and the route gate actually ask, legacy fallback included,
|
| 1030 |
+
# so the box shows what the account can reach and an untouched save stays a no-op.
|
| 1031 |
+
_default = (perm_scope.nav_may_open(users._public(uname, rec), k)
|
| 1032 |
+
if any(m.get("surface") and m["key"] == k for m in modules) else
|
| 1033 |
+
perm_scope.may_read(users._public(uname, rec), k, st=session.runtime))
|
| 1034 |
perms_out[k] = e if isinstance(e, dict) else {
|
| 1035 |
+
"access": bool(_default), "filter": None, "hiddenFields": []}
|
|
|
|
|
|
|
| 1036 |
return {"username": uname,
|
| 1037 |
"perms": perms_out,
|
| 1038 |
# S3 ask 2 β the marker rides the GET. An absent module entry means DENY on a
|
|
|
|
| 1088 |
raise err(400, "self_perms",
|
| 1089 |
"you cannot set permissions on your own account β ask another admin")
|
| 1090 |
|
| 1091 |
+
_mods = _perm_modules(session, surfaces=True)
|
| 1092 |
# ββ W36-T22 / C2 β ONE key set. It was two ("listed" and "enforced") with a refusal in the
|
| 1093 |
# gap; W36-T21 closed the gap, so every database the editor shows is one whose wall the table
|
| 1094 |
# routes apply. `session` rides so a `ut_*` schema can be read for THIS tenant.
|
api/routes_query.py
CHANGED
|
@@ -17,9 +17,17 @@ import uuid
|
|
| 17 |
from fastapi import APIRouter, Body, Depends, Response
|
| 18 |
|
| 19 |
from deps import (Session, assistant_read_scope, assistant_source_status, err,
|
| 20 |
-
require_session)
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
MAX_QUESTION = 500
|
| 25 |
MAX_VISIBLE = 24
|
|
|
|
| 17 |
from fastapi import APIRouter, Body, Depends, Response
|
| 18 |
|
| 19 |
from deps import (Session, assistant_read_scope, assistant_source_status, err,
|
| 20 |
+
module_gate, require_session)
|
| 21 |
+
|
| 22 |
+
# ββ GATED AS A ROUTER, BECAUSE UNTIL 2026-08-18 THESE ROUTES HAD NO MODULE GATE AT
|
| 23 |
+
# ALL β every door here was bare `require_session`, so "no Assistant" only ever meant "no
|
| 24 |
+
# button": the rail hid the surface while the API answered anyone signed in. The moment Manage
|
| 25 |
+
# user grew an Assistant toggle (owner ruling, same day), an unenforced deny would be a control
|
| 26 |
+
# that lies β the class this repo keeps paying for. One dependency on the router covers
|
| 27 |
+
# every route in the file, present and future, instead of fifteen signatures each one edit away
|
| 28 |
+
# from being the hole. `automation`'s routes have carried module_gate since wave 20; this brings
|
| 29 |
+
# the OTHER surface to the same rule, through the same `nav_may_open` the rail reads.
|
| 30 |
+
router = APIRouter(prefix="/api/v1", dependencies=[Depends(module_gate("analyst"))])
|
| 31 |
|
| 32 |
MAX_QUESTION = 500
|
| 33 |
MAX_VISIBLE = 24
|
platform/core/perms.py
CHANGED
|
@@ -319,6 +319,36 @@ def tenant_governable_modules(runtime, topics, ut_entries=()):
|
|
| 319 |
return out
|
| 320 |
|
| 321 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
#: β `enforced_module_keys` IS DELETED (W36-T22 / C2), NOT NEUTERED TO "every governable key".
|
| 323 |
#: It read `{m['key'] for m in modules if m.get('enforced')}`, so with the flag gone it would
|
| 324 |
#: answer the EMPTY SET and `_clean_perms` would refuse every module β and "fix" it by returning
|
|
|
|
| 319 |
return out
|
| 320 |
|
| 321 |
|
| 322 |
+
def governable_surface_modules():
|
| 323 |
+
"""The live APP SURFACES an account grant can toggle: `[{'key','label'}]`, registry order.
|
| 324 |
+
|
| 325 |
+
ββ OWNER RULING 2026-08-18, verbatim: *"I told you that everything needs to be
|
| 326 |
+
modular. And if there is a toggle for permissioning Assistant or Agent module view, it should
|
| 327 |
+
SHOW."* Until then the ONLY control over `analyst` and `automation` was the legacy
|
| 328 |
+
`user['modules']` array, which no screen has edited since the module editor was retired β
|
| 329 |
+
so three of tenant #0's four members lacked Assistant and Agents with no way to grant them
|
| 330 |
+
short of editing the store by hand.
|
| 331 |
+
|
| 332 |
+
β A SURFACE IS NOT A DATABASE AND THE EDITOR MUST KNOW THE DIFFERENCE. These rows have no
|
| 333 |
+
field schema, so the only rule that can exist for them is ACCESS β no row filter, no
|
| 334 |
+
hidden fields. `routes_admin._module_fields` answers `[]` for them (the editor's schemaless
|
| 335 |
+
rendering: a toggle and nothing else), and `_clean_perms`' field validation refuses any
|
| 336 |
+
filter or hiddenFields against an empty vocabulary, so a client cannot store a rule nothing
|
| 337 |
+
would apply.
|
| 338 |
+
|
| 339 |
+
β DERIVED, NEVER LISTED: every non-archived, non-`group_only` registry row with NO
|
| 340 |
+
`topic` that `nav_pages` would offer (not `validate_only`, not `api_surface: False`, not
|
| 341 |
+
`settings`). Today that is `analyst` (Assistant) and `automation` (Agents); a surface added
|
| 342 |
+
to the registry tomorrow is governable with no edit here β the same rule
|
| 343 |
+
`tenant_governable_modules` states for databases, applied to the other kind of row.
|
| 344 |
+
"""
|
| 345 |
+
return [{'key': m['key'], 'label': m['label']}
|
| 346 |
+
for m in registry.REGISTRY
|
| 347 |
+
if not m.get('archived') and not m.get('group_only') and not m.get('topic')
|
| 348 |
+
and not m.get('validate_only') and m.get('api_surface') is not False
|
| 349 |
+
and m['key'] != 'settings']
|
| 350 |
+
|
| 351 |
+
|
| 352 |
#: β `enforced_module_keys` IS DELETED (W36-T22 / C2), NOT NEUTERED TO "every governable key".
|
| 353 |
#: It read `{m['key'] for m in modules if m.get('enforced')}`, so with the flag gone it would
|
| 354 |
#: answer the EMPTY SET and `_clean_perms` would refuse every module β and "fix" it by returning
|
platform/core/registry.py
CHANGED
|
@@ -221,7 +221,7 @@ REGISTRY = [
|
|
| 221 |
'nav': False, # sidebar sentinel (account group) β owner IA 2026-07-12
|
| 222 |
'note': 'User scope settings: the Business Unit toggle (strict isolation) and the Data basis '
|
| 223 |
'toggle (Orders vs Invoiced) moved here from the sidebar.'},
|
| 224 |
-
{'key': 'analyst', 'label': '
|
| 225 |
'nav': False, # sidebar sentinel button; eval gate = harness/evals.py (run pre-ship, NOT in validate.py β live LLM cost)
|
| 226 |
'note': 'Ask the business a question in plain language: a small AI model calls governed tools over the semantic layer. Answers carry their query trace and drill links. AI-generated output (Art. 50 labeled).'},
|
| 227 |
]
|
|
|
|
| 221 |
'nav': False, # sidebar sentinel (account group) β owner IA 2026-07-12
|
| 222 |
'note': 'User scope settings: the Business Unit toggle (strict isolation) and the Data basis '
|
| 223 |
'toggle (Orders vs Invoiced) moved here from the sidebar.'},
|
| 224 |
+
{'key': 'analyst', 'label': 'Assistant', 'brand': False, 'hq': True, 'validate': False,
|
| 225 |
'nav': False, # sidebar sentinel button; eval gate = harness/evals.py (run pre-ship, NOT in validate.py β live LLM cost)
|
| 226 |
'note': 'Ask the business a question in plain language: a small AI model calls governed tools over the semantic layer. Answers carry their query trace and drill links. AI-generated output (Art. 50 labeled).'},
|
| 227 |
]
|
web/src/settings/ModulePermsList.tsx
CHANGED
|
@@ -135,8 +135,11 @@ export function ModulePermsList({
|
|
| 135 |
disagree (`permsModel.toPutBody`). */}
|
| 136 |
{on && schemaless ? (
|
| 137 |
<p className="set-help">
|
| 138 |
-
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
| 140 |
</p>
|
| 141 |
) : null}
|
| 142 |
|
|
|
|
| 135 |
disagree (`permsModel.toPutBody`). */}
|
| 136 |
{on && schemaless ? (
|
| 137 |
<p className="set-help">
|
| 138 |
+
{m.surface
|
| 139 |
+
? "Access is the whole rule for this module. It has no fields to hide " +
|
| 140 |
+
"and no records to filter."
|
| 141 |
+
: "No field list is available for this database, so access is all this " +
|
| 142 |
+
"editor can set for it. Conditions and hidden fields need a schema."}
|
| 143 |
</p>
|
| 144 |
) : null}
|
| 145 |
|
web/src/settings/permsModel.ts
CHANGED
|
@@ -177,6 +177,9 @@ export interface PermsModule {
|
|
| 177 |
label: string;
|
| 178 |
/** Empty β no readable schema β access toggle only (rule 1 above). */
|
| 179 |
fields: Field[];
|
|
|
|
|
|
|
|
|
|
| 180 |
/*
|
| 181 |
* ββ WAVE 36 (W36-T22 / CONTRACT C2 / OWNER RULING R6) β `enforced` IS DELETED
|
| 182 |
* FROM THIS SHAPE, NOT DEFAULTED TO `true`.
|
|
@@ -310,13 +313,14 @@ export function parseField(raw: unknown): Field | null {
|
|
| 310 |
* The LABEL does not come from here β it rides the payload's `modules` list,
|
| 311 |
* which is also what fixes the ORDER. Anything unreadable yields an EMPTY field
|
| 312 |
* list, which R9 already has a defined rendering for (access toggle only). */
|
| 313 |
-
export function parseModule(key: string, label: string, raw: unknown
|
|
|
|
| 314 |
const fields: Field[] = [];
|
| 315 |
for (const f of Array.isArray(raw) ? raw : []) {
|
| 316 |
const parsed = parseField(f);
|
| 317 |
if (parsed) fields.push(parsed);
|
| 318 |
}
|
| 319 |
-
return { key, label: label || key, fields };
|
| 320 |
}
|
| 321 |
|
| 322 |
/** A filter is taken WHOLE or not at all. A tree whose `nodes` is not a list is
|
|
@@ -415,17 +419,18 @@ export function parsePermsPayload(body: unknown): PermsPayload | null {
|
|
| 415 |
// direction this can be wrong in safely. Every row the server declares is a row
|
| 416 |
// whose wall `routes_tables` applies (W36-T21), so there is nothing left for a
|
| 417 |
// per-row flag to distinguish.
|
| 418 |
-
const declared: Array<{ key: string; label: string }> = Array.isArray(b.modules)
|
| 419 |
? (b.modules as unknown[]).flatMap((m) => {
|
| 420 |
if (!m || typeof m !== "object") return [];
|
| 421 |
const r = m as Record<string, unknown>;
|
| 422 |
return typeof r.key === "string" && r.key
|
| 423 |
-
? [{ key: r.key, label: typeof r.label === "string" ? r.label : r.key
|
|
|
|
| 424 |
: [];
|
| 425 |
})
|
| 426 |
: Object.keys(byModule).map((k) => ({ key: k, label: k }));
|
| 427 |
|
| 428 |
-
const modules = declared.map((d) => parseModule(d.key, d.label, byModule[d.key]));
|
| 429 |
const entries: PermsRecord = {};
|
| 430 |
for (const m of modules) entries[m.key] = parseEntry(rawPerms[m.key]);
|
| 431 |
|
|
|
|
| 177 |
label: string;
|
| 178 |
/** Empty β no readable schema β access toggle only (rule 1 above). */
|
| 179 |
fields: Field[];
|
| 180 |
+
/** An app surface (Assistant, Agents): access is the whole rule, by construction and
|
| 181 |
+
* not by a missing schema, so the row can say so instead of apologising. */
|
| 182 |
+
surface?: boolean;
|
| 183 |
/*
|
| 184 |
* ββ WAVE 36 (W36-T22 / CONTRACT C2 / OWNER RULING R6) β `enforced` IS DELETED
|
| 185 |
* FROM THIS SHAPE, NOT DEFAULTED TO `true`.
|
|
|
|
| 313 |
* The LABEL does not come from here β it rides the payload's `modules` list,
|
| 314 |
* which is also what fixes the ORDER. Anything unreadable yields an EMPTY field
|
| 315 |
* list, which R9 already has a defined rendering for (access toggle only). */
|
| 316 |
+
export function parseModule(key: string, label: string, raw: unknown,
|
| 317 |
+
surface = false): PermsModule {
|
| 318 |
const fields: Field[] = [];
|
| 319 |
for (const f of Array.isArray(raw) ? raw : []) {
|
| 320 |
const parsed = parseField(f);
|
| 321 |
if (parsed) fields.push(parsed);
|
| 322 |
}
|
| 323 |
+
return { key, label: label || key, fields, ...(surface ? { surface: true } : {}) };
|
| 324 |
}
|
| 325 |
|
| 326 |
/** A filter is taken WHOLE or not at all. A tree whose `nodes` is not a list is
|
|
|
|
| 419 |
// direction this can be wrong in safely. Every row the server declares is a row
|
| 420 |
// whose wall `routes_tables` applies (W36-T21), so there is nothing left for a
|
| 421 |
// per-row flag to distinguish.
|
| 422 |
+
const declared: Array<{ key: string; label: string; surface?: boolean }> = Array.isArray(b.modules)
|
| 423 |
? (b.modules as unknown[]).flatMap((m) => {
|
| 424 |
if (!m || typeof m !== "object") return [];
|
| 425 |
const r = m as Record<string, unknown>;
|
| 426 |
return typeof r.key === "string" && r.key
|
| 427 |
+
? [{ key: r.key, label: typeof r.label === "string" ? r.label : r.key,
|
| 428 |
+
surface: r.surface === true }]
|
| 429 |
: [];
|
| 430 |
})
|
| 431 |
: Object.keys(byModule).map((k) => ({ key: k, label: k }));
|
| 432 |
|
| 433 |
+
const modules = declared.map((d) => parseModule(d.key, d.label, byModule[d.key], d.surface));
|
| 434 |
const entries: PermsRecord = {};
|
| 435 |
for (const m of modules) entries[m.key] = parseEntry(rawPerms[m.key]);
|
| 436 |
|