Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/deps.py +61 -25
- api/routes_customers.py +3 -0
- api/routes_external.py +3 -1
- api/routes_products.py +3 -0
- platform/core/external_oauth.py +1 -1
- platform/core/perm_scope.py +12 -18
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "5c9b65ef",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
5c9b65ef
|
api/deps.py
CHANGED
|
@@ -186,7 +186,8 @@ def _assistant_tenant_allows(session: Session, database: str) -> bool:
|
|
| 186 |
|
| 187 |
|
| 188 |
def _assistant_preflight_request(session: Session, database: str, canonical_fields,
|
| 189 |
-
requested_fields, filters, *, require_explicit_grant: bool
|
|
|
|
| 190 |
"""Refuse an unresolved grant, field or filter before a stored record is touched."""
|
| 191 |
import core.perm_scope as perm_scope
|
| 192 |
|
|
@@ -197,7 +198,8 @@ def _assistant_preflight_request(session: Session, database: str, canonical_fiel
|
|
| 197 |
visible = (perm_scope.assistant_visible_fields(canonical_fields, session.user, database)
|
| 198 |
if grant is not None else list(canonical_fields or ()))
|
| 199 |
try:
|
| 200 |
-
perm_scope.validate_assistant_filter((grant or {}).get("filter"),
|
|
|
|
| 201 |
_assistant_requested_fields(requested_fields, visible)
|
| 202 |
perm_scope.validate_assistant_filter(filters, visible)
|
| 203 |
except ValueError as exc:
|
|
@@ -206,7 +208,7 @@ def _assistant_preflight_request(session: Session, database: str, canonical_fiel
|
|
| 206 |
|
| 207 |
|
| 208 |
def _assistant_cached_builtin(session: Session, database: str, requested_fields=None, filters=None,
|
| 209 |
-
*, mode=None):
|
| 210 |
"""The exact in-process snapshot for one built-in database, or a loud cache-miss refusal.
|
| 211 |
|
| 212 |
This intentionally reads `runtime.pool_cache` directly. Calling either route's `_pool_for`
|
|
@@ -222,18 +224,29 @@ def _assistant_cached_builtin(session: Session, database: str, requested_fields=
|
|
| 222 |
_assistant_refuse(403, "assistant_forbidden",
|
| 223 |
"your current permissions do not allow this database")
|
| 224 |
|
| 225 |
-
# Resolve the
|
| 226 |
# Its derived and overlay cells below must match the ordinary grid's scoped assembly.
|
| 227 |
import aios_grid
|
| 228 |
-
fields = aios_grid.FIELDS if database == "customer_data" else aios_grid.product_fields()
|
| 229 |
-
customer_grid = None
|
| 230 |
if database == "customer_data":
|
| 231 |
from routes_customers import grid_assembly
|
| 232 |
-
|
| 233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
_assistant_preflight_request(session, database, fields, requested_fields, filters,
|
| 235 |
-
require_explicit_grant=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
if mode in ("schema", "query_schema"):
|
|
|
|
|
|
|
| 237 |
return [], [dict(field) for field in fields], {"read": "field contract"}
|
| 238 |
|
| 239 |
team_id, agent = perm_scope.derive_pool_scope(session.user, database)
|
|
@@ -268,15 +281,16 @@ def _assistant_cached_builtin(session: Session, database: str, requested_fields=
|
|
| 268 |
or any(not isinstance(row, dict) for row in entry[1])):
|
| 269 |
_assistant_refuse(409, "assistant_snapshot_unavailable",
|
| 270 |
"this database has no app-stored snapshot for your current scope")
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
|
|
|
| 276 |
else:
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
return rows, [dict(field) for field in fields if isinstance(field, dict)], entry[0]
|
| 281 |
|
| 282 |
|
|
@@ -804,10 +818,11 @@ def assistant_read_scope(session: Session, database, fields=None, filters=None,
|
|
| 804 |
_assistant_refuse(403, "assistant_forbidden",
|
| 805 |
"Every aggregate and grouping field must be visible to every member.")
|
| 806 |
extra = {}
|
|
|
|
| 807 |
_audience_defn = None # the held definition lends C16's declaration without a store read
|
| 808 |
if key in _ASSISTANT_BUILT_INS:
|
| 809 |
rows, canonical_fields, source_version = _assistant_cached_builtin(
|
| 810 |
-
session, key, fields, filters, mode=mode)
|
| 811 |
label = _ASSISTANT_BUILT_INS[key]["label"]
|
| 812 |
source_kind = "runtime_cache"
|
| 813 |
elif key.startswith("ut_"):
|
|
@@ -872,10 +887,11 @@ def assistant_read_scope(session: Session, database, fields=None, filters=None,
|
|
| 872 |
# Spelled as membership so a third user-table source is one line, not a growing chain.
|
| 873 |
_assistant_refuse(403, "assistant_forbidden",
|
| 874 |
"your current permissions do not allow this database")
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
| 878 |
-
|
|
|
|
| 879 |
# ⭐ OWNER I16 — the tenant handle rides into the row wall here too, so one stored rule means
|
| 880 |
# the same thing in the Analyst's answer as it does on the grid (see
|
| 881 |
# `perm_scope._enrich_for_wall`).
|
|
@@ -891,6 +907,16 @@ def assistant_read_scope(session: Session, database, fields=None, filters=None,
|
|
| 891 |
# must not make a schema description load stored cells to enrich an empty row set.
|
| 892 |
if mode in ("schema", "query_schema"):
|
| 893 |
permitted_rows = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 894 |
else:
|
| 895 |
# C16: with no grant there is no row wall, but a declared recipient list still binds
|
| 896 |
# every reader, administrators included (S68-T57).
|
|
@@ -901,13 +927,23 @@ def assistant_read_scope(session: Session, database, fields=None, filters=None,
|
|
| 901 |
defn=_audience_defn))
|
| 902 |
visible = (perm_scope.assistant_visible_fields(canonical_fields, session.user, key)
|
| 903 |
if grant is not None else list(canonical_fields))
|
|
|
|
|
|
|
| 904 |
if members:
|
| 905 |
hidden = set(access["hidden"])
|
|
|
|
|
|
|
| 906 |
for member in members:
|
| 907 |
-
hidden.update(perm_scope.hidden_keys(member, key,
|
| 908 |
if mode not in ("schema", "query_schema"):
|
| 909 |
-
|
| 910 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 911 |
visible = [field for field in visible if field.get("key") not in hidden]
|
| 912 |
selected_keys = _assistant_requested_fields(fields, visible)
|
| 913 |
try:
|
|
|
|
| 186 |
|
| 187 |
|
| 188 |
def _assistant_preflight_request(session: Session, database: str, canonical_fields,
|
| 189 |
+
requested_fields, filters, *, require_explicit_grant: bool,
|
| 190 |
+
permission_fields=None):
|
| 191 |
"""Refuse an unresolved grant, field or filter before a stored record is touched."""
|
| 192 |
import core.perm_scope as perm_scope
|
| 193 |
|
|
|
|
| 198 |
visible = (perm_scope.assistant_visible_fields(canonical_fields, session.user, database)
|
| 199 |
if grant is not None else list(canonical_fields or ()))
|
| 200 |
try:
|
| 201 |
+
perm_scope.validate_assistant_filter((grant or {}).get("filter"),
|
| 202 |
+
canonical_fields if permission_fields is None else permission_fields)
|
| 203 |
_assistant_requested_fields(requested_fields, visible)
|
| 204 |
perm_scope.validate_assistant_filter(filters, visible)
|
| 205 |
except ValueError as exc:
|
|
|
|
| 208 |
|
| 209 |
|
| 210 |
def _assistant_cached_builtin(session: Session, database: str, requested_fields=None, filters=None,
|
| 211 |
+
*, mode=None, permission_scope=None, members=()):
|
| 212 |
"""The exact in-process snapshot for one built-in database, or a loud cache-miss refusal.
|
| 213 |
|
| 214 |
This intentionally reads `runtime.pool_cache` directly. Calling either route's `_pool_for`
|
|
|
|
| 224 |
_assistant_refuse(403, "assistant_forbidden",
|
| 225 |
"your current permissions do not allow this database")
|
| 226 |
|
| 227 |
+
# Resolve the grid's permitted field contract without rows before any cache read.
|
| 228 |
# Its derived and overlay cells below must match the ordinary grid's scoped assembly.
|
| 229 |
import aios_grid
|
|
|
|
|
|
|
| 230 |
if database == "customer_data":
|
| 231 |
from routes_customers import grid_assembly
|
| 232 |
+
grid_scope = "customer"
|
| 233 |
+
else:
|
| 234 |
+
from routes_products import product_assembly as grid_assembly
|
| 235 |
+
grid_scope = "product"
|
| 236 |
+
grid = grid_assembly(session, scope=grid_scope, consume_corrections=False, with_rows=False)
|
| 237 |
+
fields = grid["fields"]
|
| 238 |
+
internal = grid.get("_permission_scope") or {"fields": fields, "rows": [], "row_fields": fields}
|
| 239 |
_assistant_preflight_request(session, database, fields, requested_fields, filters,
|
| 240 |
+
require_explicit_grant=True, permission_fields=internal["fields"])
|
| 241 |
+
for member in members:
|
| 242 |
+
try:
|
| 243 |
+
perm_scope.validate_assistant_filter(
|
| 244 |
+
(perm_scope.assistant_entry(member, database) or {}).get("filter"), internal["fields"])
|
| 245 |
+
except ValueError as exc:
|
| 246 |
+
_assistant_refuse(400, "assistant_bad_filter", str(exc))
|
| 247 |
if mode in ("schema", "query_schema"):
|
| 248 |
+
if permission_scope is not None and "_permission_scope" in grid:
|
| 249 |
+
permission_scope.update(internal)
|
| 250 |
return [], [dict(field) for field in fields], {"read": "field contract"}
|
| 251 |
|
| 252 |
team_id, agent = perm_scope.derive_pool_scope(session.user, database)
|
|
|
|
| 281 |
or any(not isinstance(row, dict) for row in entry[1])):
|
| 282 |
_assistant_refuse(409, "assistant_snapshot_unavailable",
|
| 283 |
"this database has no app-stored snapshot for your current scope")
|
| 284 |
+
grid = grid_assembly(session, scope=grid_scope, consume_corrections=False, with_rows=True)
|
| 285 |
+
if permission_scope is not None and "_permission_scope" in grid:
|
| 286 |
+
permission_scope.update(grid["_permission_scope"])
|
| 287 |
+
if database == "product_data":
|
| 288 |
+
from routes_products import product_rows
|
| 289 |
+
rows = product_rows(grid)
|
| 290 |
else:
|
| 291 |
+
rows = aios_grid.rows_from_pool(grid["rows_src"], fields,
|
| 292 |
+
(grid.get("ws") or {}).get("overlays") or {},
|
| 293 |
+
derived=grid.get("derived"))
|
| 294 |
return rows, [dict(field) for field in fields if isinstance(field, dict)], entry[0]
|
| 295 |
|
| 296 |
|
|
|
|
| 818 |
_assistant_refuse(403, "assistant_forbidden",
|
| 819 |
"Every aggregate and grouping field must be visible to every member.")
|
| 820 |
extra = {}
|
| 821 |
+
builtin_scope = {}
|
| 822 |
_audience_defn = None # the held definition lends C16's declaration without a store read
|
| 823 |
if key in _ASSISTANT_BUILT_INS:
|
| 824 |
rows, canonical_fields, source_version = _assistant_cached_builtin(
|
| 825 |
+
session, key, fields, filters, mode=mode, permission_scope=builtin_scope, members=members)
|
| 826 |
label = _ASSISTANT_BUILT_INS[key]["label"]
|
| 827 |
source_kind = "runtime_cache"
|
| 828 |
elif key.startswith("ut_"):
|
|
|
|
| 887 |
# Spelled as membership so a third user-table source is one line, not a growing chain.
|
| 888 |
_assistant_refuse(403, "assistant_forbidden",
|
| 889 |
"your current permissions do not allow this database")
|
| 890 |
+
if not builtin_scope:
|
| 891 |
+
try:
|
| 892 |
+
perm_scope.validate_assistant_filter((grant or {}).get("filter"), canonical_fields)
|
| 893 |
+
except ValueError as exc:
|
| 894 |
+
_assistant_refuse(400, "assistant_bad_filter", str(exc))
|
| 895 |
# ⭐ OWNER I16 — the tenant handle rides into the row wall here too, so one stored rule means
|
| 896 |
# the same thing in the Analyst's answer as it does on the grid (see
|
| 897 |
# `perm_scope._enrich_for_wall`).
|
|
|
|
| 907 |
# must not make a schema description load stored cells to enrich an empty row set.
|
| 908 |
if mode in ("schema", "query_schema"):
|
| 909 |
permitted_rows = []
|
| 910 |
+
elif builtin_scope:
|
| 911 |
+
# The grid already applied the member's row wall before masking its operands.
|
| 912 |
+
permitted_rows = rows
|
| 913 |
+
if session.admin:
|
| 914 |
+
# Retain the Assistant's explicit admin grant, which the interactive grid bypasses.
|
| 915 |
+
allowed = perm_scope.assistant_apply_row_scope(
|
| 916 |
+
builtin_scope["rows"], session.user, key, builtin_scope["row_fields"],
|
| 917 |
+
st=session.runtime)
|
| 918 |
+
allowed_pids = {row.get("pid") for row in allowed}
|
| 919 |
+
permitted_rows = [row for row in permitted_rows if row.get("pid") in allowed_pids]
|
| 920 |
else:
|
| 921 |
# C16: with no grant there is no row wall, but a declared recipient list still binds
|
| 922 |
# every reader, administrators included (S68-T57).
|
|
|
|
| 927 |
defn=_audience_defn))
|
| 928 |
visible = (perm_scope.assistant_visible_fields(canonical_fields, session.user, key)
|
| 929 |
if grant is not None else list(canonical_fields))
|
| 930 |
+
hidden = perm_scope.hidden_keys(session.user, key, canonical_fields, st=session.runtime)
|
| 931 |
+
visible = [field for field in visible if field.get("key") not in hidden]
|
| 932 |
if members:
|
| 933 |
hidden = set(access["hidden"])
|
| 934 |
+
member_rows = builtin_scope.get("rows", permitted_rows)
|
| 935 |
+
member_fields = builtin_scope.get("fields", canonical_fields)
|
| 936 |
for member in members:
|
| 937 |
+
hidden.update(perm_scope.hidden_keys(member, key, member_fields, st=session.runtime))
|
| 938 |
if mode not in ("schema", "query_schema"):
|
| 939 |
+
member_rows = perm_scope.apply_row_scope(
|
| 940 |
+
member_rows, member, key, builtin_scope.get("row_fields", canonical_fields),
|
| 941 |
+
st=session.runtime)
|
| 942 |
+
if builtin_scope and mode not in ("schema", "query_schema"):
|
| 943 |
+
allowed_pids = {row.get("pid") for row in member_rows}
|
| 944 |
+
permitted_rows = [row for row in permitted_rows if row.get("pid") in allowed_pids]
|
| 945 |
+
elif not builtin_scope:
|
| 946 |
+
permitted_rows = member_rows
|
| 947 |
visible = [field for field in visible if field.get("key") not in hidden]
|
| 948 |
selected_keys = _assistant_requested_fields(fields, visible)
|
| 949 |
try:
|
api/routes_customers.py
CHANGED
|
@@ -890,6 +890,8 @@ def _compute_grid_assembly(session: Session, scope: str = "customer", storage_ke
|
|
| 890 |
# HIDDEN. So an unthreaded `st` UNDER-shares (a grantee cannot see their own column) rather
|
| 891 |
# than over-shares — visible and reportable, but still wrong, and `visible_fields`' own note
|
| 892 |
# requires the two calls to agree about it.
|
|
|
|
|
|
|
| 893 |
hidden = perm_scope.hidden_keys(session.user, MODULE, fields, st=rt)
|
| 894 |
if hidden:
|
| 895 |
fields = [f for f in fields if f.get("key") not in hidden]
|
|
@@ -1000,6 +1002,7 @@ def _compute_grid_assembly(session: Session, scope: str = "customer", storage_ke
|
|
| 1000 |
for pid, cells in _ovc.items()}
|
| 1001 |
return {"rows_src": rows_src, "pids": pids, "ws": ws, "workspace": workspace,
|
| 1002 |
"fields": fields, "views": views, "lists": lists, "derived": derived,
|
|
|
|
| 1003 |
"measures": measures, "measure_sets": measure_sets, "today": today,
|
| 1004 |
"team_id": team_id, "routes": normalized_routes, "zones": normalized_zones}
|
| 1005 |
|
|
|
|
| 890 |
# HIDDEN. So an unthreaded `st` UNDER-shares (a grantee cannot see their own column) rather
|
| 891 |
# than over-shares — visible and reportable, but still wrong, and `visible_fields`' own note
|
| 892 |
# requires the two calls to agree about it.
|
| 893 |
+
# Internal wall inputs stay outside workspace, fields and all public row projections.
|
| 894 |
+
permission_scope = {"fields": fields, "rows": rows_src, "row_fields": aios_grid.FIELDS}
|
| 895 |
hidden = perm_scope.hidden_keys(session.user, MODULE, fields, st=rt)
|
| 896 |
if hidden:
|
| 897 |
fields = [f for f in fields if f.get("key") not in hidden]
|
|
|
|
| 1002 |
for pid, cells in _ovc.items()}
|
| 1003 |
return {"rows_src": rows_src, "pids": pids, "ws": ws, "workspace": workspace,
|
| 1004 |
"fields": fields, "views": views, "lists": lists, "derived": derived,
|
| 1005 |
+
"_permission_scope": permission_scope,
|
| 1006 |
"measures": measures, "measure_sets": measure_sets, "today": today,
|
| 1007 |
"team_id": team_id, "routes": normalized_routes, "zones": normalized_zones}
|
| 1008 |
|
api/routes_external.py
CHANGED
|
@@ -3283,7 +3283,9 @@ def _mcp_guide(session: Session) -> str:
|
|
| 3283 |
lines = ["# Loopable guide", "", f"Signed in as {session.uname}.", "", MCP_INSTRUCTIONS, "",
|
| 3284 |
"## Your databases", "",
|
| 3285 |
"Call describe_database with a key below for its fields before you query it.", ""]
|
| 3286 |
-
|
|
|
|
|
|
|
| 3287 |
for row in rows:
|
| 3288 |
note = "" if row["answerable"] else f" Not queryable right now: {_markdown_inline(row['reason'])}"
|
| 3289 |
lines.append(f"- `{row['database']}`: {_markdown_inline(row['label'])}.{note}")
|
|
|
|
| 3283 |
lines = ["# Loopable guide", "", f"Signed in as {session.uname}.", "", MCP_INSTRUCTIONS, "",
|
| 3284 |
"## Your databases", "",
|
| 3285 |
"Call describe_database with a key below for its fields before you query it.", ""]
|
| 3286 |
+
key_databases = _key_scope(session)[1]
|
| 3287 |
+
rows = [row for row in _resolve_external_scope(session) if row["permitted"]
|
| 3288 |
+
and external_access.database_allowed(key_databases, row["database"])]
|
| 3289 |
for row in rows:
|
| 3290 |
note = "" if row["answerable"] else f" Not queryable right now: {_markdown_inline(row['reason'])}"
|
| 3291 |
lines.append(f"- `{row['database']}`: {_markdown_inline(row['label'])}.{note}")
|
api/routes_products.py
CHANGED
|
@@ -504,6 +504,8 @@ def _compute_product_assembly(session: Session, scope: str = "product", storage_
|
|
| 504 |
projected.append(item)
|
| 505 |
fields = list(fields) + projected
|
| 506 |
|
|
|
|
|
|
|
| 507 |
hidden = perm_scope.hidden_keys(session.user, MODULE, fields, st=session.runtime)
|
| 508 |
if hidden:
|
| 509 |
fields = [f for f in fields if f.get("key") not in hidden]
|
|
@@ -575,6 +577,7 @@ def _compute_product_assembly(session: Session, scope: str = "product", storage_
|
|
| 575 |
for field in fields]
|
| 576 |
return {"rows_src": rows_src, "pids": pids, "ws": ws, "workspace": workspace,
|
| 577 |
"fields": fields, "views": views, "lists": lists,
|
|
|
|
| 578 |
"derived": derived,
|
| 579 |
"measures": measures, "measure_sets": measure_sets, "today": today,
|
| 580 |
"team_id": team_id}
|
|
|
|
| 504 |
projected.append(item)
|
| 505 |
fields = list(fields) + projected
|
| 506 |
|
| 507 |
+
# Internal wall inputs stay outside workspace, fields and all public row projections.
|
| 508 |
+
permission_scope = {"fields": fields, "rows": rows_src, "row_fields": fields_base}
|
| 509 |
hidden = perm_scope.hidden_keys(session.user, MODULE, fields, st=session.runtime)
|
| 510 |
if hidden:
|
| 511 |
fields = [f for f in fields if f.get("key") not in hidden]
|
|
|
|
| 577 |
for field in fields]
|
| 578 |
return {"rows_src": rows_src, "pids": pids, "ws": ws, "workspace": workspace,
|
| 579 |
"fields": fields, "views": views, "lists": lists,
|
| 580 |
+
"_permission_scope": permission_scope,
|
| 581 |
"derived": derived,
|
| 582 |
"measures": measures, "measure_sets": measure_sets, "today": today,
|
| 583 |
"team_id": team_id}
|
platform/core/external_oauth.py
CHANGED
|
@@ -634,7 +634,7 @@ def _live_permission_user(username: str, tenant: str) -> dict:
|
|
| 634 |
or any(not isinstance(field, str) for field in entry["hiddenFields"])):
|
| 635 |
raise ExternalOAuthAuthError(AUTH_ERROR)
|
| 636 |
modules = record.get("modules", "all")
|
| 637 |
-
if modules != "all" and (not isinstance(modules, (list, tuple))
|
| 638 |
or any(not isinstance(key, str) or not key for key in modules)):
|
| 639 |
raise ExternalOAuthAuthError(AUTH_ERROR)
|
| 640 |
public = users._public(username, record)
|
|
|
|
| 634 |
or any(not isinstance(field, str) for field in entry["hiddenFields"])):
|
| 635 |
raise ExternalOAuthAuthError(AUTH_ERROR)
|
| 636 |
modules = record.get("modules", "all")
|
| 637 |
+
if modules != "all" and (not isinstance(modules, (list, tuple))
|
| 638 |
or any(not isinstance(key, str) or not key for key in modules)):
|
| 639 |
raise ExternalOAuthAuthError(AUTH_ERROR)
|
| 640 |
public = users._public(username, record)
|
platform/core/perm_scope.py
CHANGED
|
@@ -219,19 +219,7 @@ def nav_may_open(user, key, st=None):
|
|
| 219 |
|
| 220 |
|
| 221 |
def assistant_entry(user, module):
|
| 222 |
-
"""
|
| 223 |
-
|
| 224 |
-
The interactive application retains an admin break-glass path and a temporary legacy-grant
|
| 225 |
-
compatibility path. Neither is an answer at the Assistant's app-stored data boundary:
|
| 226 |
-
that reader must be able to name the migrated grant that admitted a database. In particular,
|
| 227 |
-
a store-outage admin identity with no ``perms`` document is not an unresolved permission that
|
| 228 |
-
may be widened into data access.
|
| 229 |
-
|
| 230 |
-
⭐ S67-T34 / D-276: ONE NAMED EXCEPTION, the grant the NAVIGATION uses. For the two registry
|
| 231 |
-
topics in ``ASSISTANT_NAV_TOPICS`` an administrator account is admitted unfiltered (unless
|
| 232 |
-
explicitly unticked), because ``nav_may_open`` leg 1 opens them to it; the AI list must equal
|
| 233 |
-
the nav (R33). See the comment at that leg for why the outage identity no longer reaches it.
|
| 234 |
-
"""
|
| 235 |
e = entry(user, module)
|
| 236 |
# T55: the AI list and read use the same named admin grant for the Data topics.
|
| 237 |
# Return the complete entry so hidden fields and row restrictions survive admission.
|
|
@@ -239,8 +227,11 @@ def assistant_entry(user, module):
|
|
| 239 |
if isinstance(e, dict) and e.get('access') is False:
|
| 240 |
return None
|
| 241 |
return dict(e) if isinstance(e, dict) else {'access': True, 'filter': None}
|
| 242 |
-
if
|
| 243 |
-
|
|
|
|
|
|
|
|
|
|
| 244 |
return e
|
| 245 |
# ⭐⭐ S67-T34 / D-276 / R26: THE ADMINISTRATOR THE NAVIGATION ADMITS. `nav_may_open` leg 1
|
| 246 |
# opens every registry topic to an administrator, and `_clean_perms` writes no per-topic
|
|
@@ -250,12 +241,10 @@ def assistant_entry(user, module):
|
|
| 250 |
# answer is the grant the nav already uses, admitted for exactly these topics: an account
|
| 251 |
# whose ROLE is admin, minus an explicit `access: false` (narrower than the nav, never wider).
|
| 252 |
# Unfiltered, as the nav's break-glass is.
|
| 253 |
-
# ⚠ THE STORE-OUTAGE IDENTITY
|
| 254 |
# (it admits a stored record or the QA runner, nothing else), so the role is read off a
|
| 255 |
# stored account here. If a synthetic admin identity is ever reintroduced, it must be kept
|
| 256 |
# out of this leg.
|
| 257 |
-
# ⛔ NOT A MEMBER. A non-administrator still needs the explicit migrated grant above, so a
|
| 258 |
-
# user without it does not see the database (the NC).
|
| 259 |
return None
|
| 260 |
|
| 261 |
|
|
@@ -1866,6 +1855,11 @@ def derive_pool_scope(user, module):
|
|
| 1866 |
if perms.is_admin(user):
|
| 1867 |
return None, None
|
| 1868 |
team_id, agent = _derive_from_filter(user, module)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1869 |
if team_id is None and module not in BU_FILTERABLE_MODULES:
|
| 1870 |
team_id = perms.scope_team_id(user)
|
| 1871 |
return team_id, agent
|
|
|
|
| 219 |
|
| 220 |
|
| 221 |
def assistant_entry(user, module):
|
| 222 |
+
"""Resolve an effective database grant without losing its stored row or field restrictions."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
e = entry(user, module)
|
| 224 |
# T55: the AI list and read use the same named admin grant for the Data topics.
|
| 225 |
# Return the complete entry so hidden fields and row restrictions survive admission.
|
|
|
|
| 227 |
if isinstance(e, dict) and e.get('access') is False:
|
| 228 |
return None
|
| 229 |
return dict(e) if isinstance(e, dict) else {'access': True, 'filter': None}
|
| 230 |
+
if module in ASSISTANT_NAV_TOPICS:
|
| 231 |
+
if not may_read(user, module):
|
| 232 |
+
return None
|
| 233 |
+
return e if e is not None else {'access': True, 'filter': None}
|
| 234 |
+
if (isinstance(e, dict) and bool(e.get('access', True)) and may_access(user, module)):
|
| 235 |
return e
|
| 236 |
# ⭐⭐ S67-T34 / D-276 / R26: THE ADMINISTRATOR THE NAVIGATION ADMITS. `nav_may_open` leg 1
|
| 237 |
# opens every registry topic to an administrator, and `_clean_perms` writes no per-topic
|
|
|
|
| 241 |
# answer is the grant the nav already uses, admitted for exactly these topics: an account
|
| 242 |
# whose ROLE is admin, minus an explicit `access: false` (narrower than the nav, never wider).
|
| 243 |
# Unfiltered, as the nav's break-glass is.
|
| 244 |
+
# ⚠ THE STORE-OUTAGE IDENTITY is no longer built by `deps._user_for`
|
| 245 |
# (it admits a stored record or the QA runner, nothing else), so the role is read off a
|
| 246 |
# stored account here. If a synthetic admin identity is ever reintroduced, it must be kept
|
| 247 |
# out of this leg.
|
|
|
|
|
|
|
| 248 |
return None
|
| 249 |
|
| 250 |
|
|
|
|
| 1855 |
if perms.is_admin(user):
|
| 1856 |
return None, None
|
| 1857 |
team_id, agent = _derive_from_filter(user, module)
|
| 1858 |
+
# Legacy account scope remains binding even when a stored filter adds another restriction.
|
| 1859 |
+
if not is_migrated(user):
|
| 1860 |
+
legacy_team = perms.scope_team_id(user)
|
| 1861 |
+
team_id = legacy_team if legacy_team is not None else team_id
|
| 1862 |
+
agent = perms.scope_agent(user) or agent
|
| 1863 |
if team_id is None and module not in BU_FILTERABLE_MODULES:
|
| 1864 |
team_id = perms.scope_team_id(user)
|
| 1865 |
return team_id, agent
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
d8b1ab6202bce6956e1a5f83f5ab4279b05aa8ccb54e6e281a9cd334a8f296cf
|