Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/routes_admin.py +114 -23
- platform/core/shares.py +13 -1
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "6304d13858f6",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
6304d13858f6
|
api/routes_admin.py
CHANGED
|
@@ -1717,9 +1717,13 @@ def _row_wall_blind_keys(key, session=None, nodes=(), reasons=None, verdicts=Non
|
|
| 1717 |
return blind
|
| 1718 |
|
| 1719 |
|
| 1720 |
-
def _clean_perms(v, governed_keys=None, session=None, stored=None, stale_out=None
|
|
|
|
| 1721 |
"""Validate a whole `perms` block. FAIL-CLOSED, and LOUD rather than lenient.
|
| 1722 |
|
|
|
|
|
|
|
|
|
|
| 1723 |
ββ W46-T35 β `stored` AND `stale_out` ARE OPTIONAL AND THE DEFAULT IS THE OLD BEHAVIOUR.
|
| 1724 |
`stored` is the block this account ALREADY holds, handed down by `put_perms` from the
|
| 1725 |
registry read it has already made β not a second read at a second moment, which is what the
|
|
@@ -1807,7 +1811,9 @@ def _clean_perms(v, governed_keys=None, session=None, stored=None, stale_out=Non
|
|
| 1807 |
# measured, not feared. `clean_filter_tree` takes bare strings and cannot see the flag,
|
| 1808 |
# so the narrowing has to happen HERE, at the call.
|
| 1809 |
# Reuse submitted verdicts in the picker vocabulary so each leaf is judged once.
|
| 1810 |
-
fields_here = _module_fields(key, session=session,
|
|
|
|
|
|
|
| 1811 |
valid_keys = {f["key"] for f in fields_here}
|
| 1812 |
filter_keys = {f["key"] for f in fields_here if f.get("filterable")}
|
| 1813 |
# ββ W41-T09 / R8 β THE COLUMNS THE ADMIN-OWNER RULE TOOK OUT OF THE BUILDER, READ OFF
|
|
@@ -2240,6 +2246,25 @@ def _prune_to_module(tree, valid_keys):
|
|
| 2240 |
return {"conj": tree.get("conj", "and"), "nodes": nodes} if nodes else None
|
| 2241 |
|
| 2242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2243 |
@router.get("/admin/users/{username}/perms")
|
| 2244 |
def get_perms(username: str, session: Session = Depends(admin_gate)):
|
| 2245 |
"""This account's permission block plus the field schema the editor needs to render it."""
|
|
@@ -2250,26 +2275,19 @@ def get_perms(username: str, session: Session = Depends(admin_gate)):
|
|
| 2250 |
# 404, never 403, because "that account exists in another company" is itself a leak.
|
| 2251 |
raise err(404, "no_such_user", f"no account named {uname!r}")
|
| 2252 |
import core.perm_scope as perm_scope
|
| 2253 |
-
from
|
| 2254 |
-
from core import user_tables, shares, freeze_notice
|
| 2255 |
-
from routes_customers import _AssemblyStore
|
| 2256 |
|
| 2257 |
try:
|
| 2258 |
shares.reconcile_database_grants(session.runtime, tenant=session.tenant)
|
| 2259 |
except freeze_notice.DataInputFrozen:
|
| 2260 |
raise
|
| 2261 |
except Exception as exc:
|
| 2262 |
-
|
|
|
|
|
|
|
| 2263 |
|
| 2264 |
-
#
|
| 2265 |
-
|
| 2266 |
-
# writes and their required post-write readback below continue through the original store.
|
| 2267 |
-
session = copy(session)
|
| 2268 |
-
session._permission_roster = reg
|
| 2269 |
-
try:
|
| 2270 |
-
session.runtime = user_tables.lend_defs(_AssemblyStore(session.runtime, schema_only=True))
|
| 2271 |
-
except Exception:
|
| 2272 |
-
raise err(503, "schema_unavailable", "The permission field definitions are unavailable. Try again.")
|
| 2273 |
|
| 2274 |
rec = reg[uname]
|
| 2275 |
stored = rec.get("perms") or {}
|
|
@@ -2342,6 +2360,7 @@ def get_perms(username: str, session: Session = Depends(admin_gate)):
|
|
| 2342 |
if _gone:
|
| 2343 |
stale_hidden_by_module[k] = _gone
|
| 2344 |
perms_out = {}
|
|
|
|
| 2345 |
for k in governed:
|
| 2346 |
e = stored.get(k)
|
| 2347 |
# ββ W36-T22 β THE DEFAULT IS `may_read`, NOT `may_access`, AND THE DIFFERENCE IS AN
|
|
@@ -2376,7 +2395,8 @@ def get_perms(username: str, session: Session = Depends(admin_gate)):
|
|
| 2376 |
perm_scope.may_read(users._public(uname, rec), k, st=session.runtime))
|
| 2377 |
if (str(k).startswith("ut_") and isinstance(e, dict)
|
| 2378 |
and e.get("access") is True and not _default):
|
| 2379 |
-
|
|
|
|
| 2380 |
# ββ W38-T19 β `metrics` RIDES EVERY ENTRY, BACKFILLED TO GRANTED ON A RECORD WRITTEN
|
| 2381 |
# BEFORE THE KEY EXISTED. The wire is TOTAL on purpose: the client's own parse already
|
| 2382 |
# reads an absent key as granted, so this line changes no rendering β what it changes is
|
|
@@ -2424,6 +2444,8 @@ def get_perms(username: str, session: Session = Depends(admin_gate)):
|
|
| 2424 |
# `is_migrated` slip away from consuming `_fold_legacy_scope`'s one chance, which is
|
| 2425 |
# the BU leak the guard above exists for.
|
| 2426 |
"stale_hidden_by_module": stale_hidden_by_module,
|
|
|
|
|
|
|
| 2427 |
# ββ W46-T34 β `{module: {count, refused, status, reason}}`, the metric census
|
| 2428 |
# beside the field list it summarises. `status` is `ok` | `none` | `unavailable`,
|
| 2429 |
# and the third is the one that had no way to be said before: an empty metric list
|
|
@@ -2519,9 +2541,49 @@ def migrate_perms(body: dict = Body(default=None), session: Session = Depends(ad
|
|
| 2519 |
if not report["reconciliation"]["ok"]]}
|
| 2520 |
|
| 2521 |
|
| 2522 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2523 |
"""R15/C5: explicit ut_* access grants editor authority; explicit off removes the share.
|
| 2524 |
|
|
|
|
|
|
|
|
|
|
| 2525 |
Two doors answer two questions: the access rule decides WHICH rows, a `core.shares` `database`
|
| 2526 |
grant decides IF the member sees and edits it, so the editor's toggle writes both. Re-saving
|
| 2527 |
an enabled entry repairs old view-only grants. Other principals, owners and provenance stay
|
|
@@ -2561,10 +2623,25 @@ def _sync_database_shares(session, uname, before, after):
|
|
| 2561 |
if now:
|
| 2562 |
entries.append({**(held[0] if held else {}), "user": uname, "role": "edit"})
|
| 2563 |
try:
|
| 2564 |
-
shares.set_grants("database", key, entries, st=session.runtime,
|
| 2565 |
-
|
| 2566 |
except shares.GrantsChanged as exc:
|
| 2567 |
raise err(409, "shares_changed", "Database sharing changed. Save access again.") from exc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2568 |
|
| 2569 |
|
| 2570 |
def _set_database_request_share(session, key, entries, held, snapshot):
|
|
@@ -2835,9 +2912,14 @@ def put_perms(username: str, body: dict = Body(default=None),
|
|
| 2835 |
# control for it: a report that lives only in a client this ticket does not own would be a
|
| 2836 |
# feature nobody ships [[two-lanes-one-contract-dead-feature]].
|
| 2837 |
_stale = {}
|
|
|
|
|
|
|
|
|
|
| 2838 |
cleaned = _clean_perms(body.get("perms"),
|
| 2839 |
governed_keys={m["key"] for m in _mods}, session=session,
|
| 2840 |
-
stored=reg[uname].get("perms"), stale_out=_stale
|
|
|
|
|
|
|
| 2841 |
governed = {m["key"] for m in _mods}
|
| 2842 |
opaque = {key: entry for key, entry in cleaned.items() if key not in governed}
|
| 2843 |
known = _fold_legacy_scope(reg[uname],
|
|
@@ -2845,6 +2927,7 @@ def put_perms(username: str, body: dict = Body(default=None),
|
|
| 2845 |
session=session)
|
| 2846 |
_guard_bu_widening(reg[uname], known, bool(body.get("confirm_widen")))
|
| 2847 |
cleaned = dict(known, **opaque)
|
|
|
|
| 2848 |
users.set_access(uname, perms=cleaned)
|
| 2849 |
fresh = _registry()
|
| 2850 |
rec = fresh.get(uname) or {}
|
|
@@ -2853,9 +2936,17 @@ def put_perms(username: str, body: dict = Body(default=None),
|
|
| 2853 |
# the wall is up when it is not β the one direction this must never fail in.
|
| 2854 |
raise err(503, "store_unavailable",
|
| 2855 |
"the permissions were not saved; the account is UNCHANGED")
|
| 2856 |
-
|
| 2857 |
-
|
| 2858 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2859 |
return {"username": uname, "perms": rec.get("perms") or {},
|
| 2860 |
"perms_v": int(rec.get("perms_v") or 0),
|
| 2861 |
# W46-T35 β `{module: [key, ...]}`, empty on an ordinary save. What the save cleared
|
|
|
|
| 1717 |
return blind
|
| 1718 |
|
| 1719 |
|
| 1720 |
+
def _clean_perms(v, governed_keys=None, session=None, stored=None, stale_out=None,
|
| 1721 |
+
fields_session=None, vocabulary_memo=None):
|
| 1722 |
"""Validate a whole `perms` block. FAIL-CLOSED, and LOUD rather than lenient.
|
| 1723 |
|
| 1724 |
+
`fields_session` and `vocabulary_memo` are optional: `put_perms` passes the snapshot and memo
|
| 1725 |
+
`get_perms` builds, so the field vocabulary reads each store document once per save.
|
| 1726 |
+
|
| 1727 |
ββ W46-T35 β `stored` AND `stale_out` ARE OPTIONAL AND THE DEFAULT IS THE OLD BEHAVIOUR.
|
| 1728 |
`stored` is the block this account ALREADY holds, handed down by `put_perms` from the
|
| 1729 |
registry read it has already made β not a second read at a second moment, which is what the
|
|
|
|
| 1811 |
# measured, not feared. `clean_filter_tree` takes bare strings and cannot see the flag,
|
| 1812 |
# so the narrowing has to happen HERE, at the call.
|
| 1813 |
# Reuse submitted verdicts in the picker vocabulary so each leaf is judged once.
|
| 1814 |
+
fields_here = _module_fields(key, session=fields_session or session,
|
| 1815 |
+
wall_verdicts=wall_verdicts,
|
| 1816 |
+
vocabulary_memo=vocabulary_memo)
|
| 1817 |
valid_keys = {f["key"] for f in fields_here}
|
| 1818 |
filter_keys = {f["key"] for f in fields_here if f.get("filterable")}
|
| 1819 |
# ββ W41-T09 / R8 β THE COLUMNS THE ADMIN-OWNER RULE TOOK OUT OF THE BUILDER, READ OFF
|
|
|
|
| 2246 |
return {"conj": tree.get("conj", "and"), "nodes": nodes} if nodes else None
|
| 2247 |
|
| 2248 |
|
| 2249 |
+
def _perms_read_snapshot(session, roster):
|
| 2250 |
+
"""A request-only copy of `session` that reads definitions, grants and the roster once.
|
| 2251 |
+
|
| 2252 |
+
The editor's picker and the save's validator both build their field vocabulary through it.
|
| 2253 |
+
It never enters a write door or outlives the request.
|
| 2254 |
+
"""
|
| 2255 |
+
from copy import copy
|
| 2256 |
+
from core import user_tables
|
| 2257 |
+
from routes_customers import _AssemblyStore
|
| 2258 |
+
|
| 2259 |
+
snapshot = copy(session)
|
| 2260 |
+
snapshot._permission_roster = roster
|
| 2261 |
+
try:
|
| 2262 |
+
snapshot.runtime = user_tables.lend_defs(_AssemblyStore(session.runtime, schema_only=True))
|
| 2263 |
+
except Exception:
|
| 2264 |
+
raise err(503, "schema_unavailable", "The permission field definitions are unavailable. Try again.")
|
| 2265 |
+
return snapshot
|
| 2266 |
+
|
| 2267 |
+
|
| 2268 |
@router.get("/admin/users/{username}/perms")
|
| 2269 |
def get_perms(username: str, session: Session = Depends(admin_gate)):
|
| 2270 |
"""This account's permission block plus the field schema the editor needs to render it."""
|
|
|
|
| 2275 |
# 404, never 403, because "that account exists in another company" is itself a leak.
|
| 2276 |
raise err(404, "no_such_user", f"no account named {uname!r}")
|
| 2277 |
import core.perm_scope as perm_scope
|
| 2278 |
+
from core import shares, freeze_notice
|
|
|
|
|
|
|
| 2279 |
|
| 2280 |
try:
|
| 2281 |
shares.reconcile_database_grants(session.runtime, tenant=session.tenant)
|
| 2282 |
except freeze_notice.DataInputFrozen:
|
| 2283 |
raise
|
| 2284 |
except Exception as exc:
|
| 2285 |
+
# Boot retries the repair. The page still opens and names each tick left without a grant.
|
| 2286 |
+
import logging
|
| 2287 |
+
logging.getLogger(__name__).warning("Database grant repair deferred: %s", type(exc).__name__)
|
| 2288 |
|
| 2289 |
+
# Global account writes and their required post-write readback below use the original store.
|
| 2290 |
+
session = _perms_read_snapshot(session, reg)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2291 |
|
| 2292 |
rec = reg[uname]
|
| 2293 |
stored = rec.get("perms") or {}
|
|
|
|
| 2360 |
if _gone:
|
| 2361 |
stale_hidden_by_module[k] = _gone
|
| 2362 |
perms_out = {}
|
| 2363 |
+
unsynced_access = []
|
| 2364 |
for k in governed:
|
| 2365 |
e = stored.get(k)
|
| 2366 |
# ββ W36-T22 β THE DEFAULT IS `may_read`, NOT `may_access`, AND THE DIFFERENCE IS AN
|
|
|
|
| 2395 |
perm_scope.may_read(users._public(uname, rec), k, st=session.runtime))
|
| 2396 |
if (str(k).startswith("ut_") and isinstance(e, dict)
|
| 2397 |
and e.get("access") is True and not _default):
|
| 2398 |
+
# A tick whose share grant is missing still opens, so an admin can see it and re-save.
|
| 2399 |
+
unsynced_access.append(k)
|
| 2400 |
# ββ W38-T19 β `metrics` RIDES EVERY ENTRY, BACKFILLED TO GRANTED ON A RECORD WRITTEN
|
| 2401 |
# BEFORE THE KEY EXISTED. The wire is TOTAL on purpose: the client's own parse already
|
| 2402 |
# reads an absent key as granted, so this line changes no rendering β what it changes is
|
|
|
|
| 2444 |
# `is_migrated` slip away from consuming `_fold_legacy_scope`'s one chance, which is
|
| 2445 |
# the BU leak the guard above exists for.
|
| 2446 |
"stale_hidden_by_module": stale_hidden_by_module,
|
| 2447 |
+
# The `ut_*` keys stored as access while the account cannot open them: a save repairs them.
|
| 2448 |
+
"unsynced_access": unsynced_access,
|
| 2449 |
# ββ W46-T34 β `{module: {count, refused, status, reason}}`, the metric census
|
| 2450 |
# beside the field list it summarises. `status` is `ok` | `none` | `unavailable`,
|
| 2451 |
# and the third is the one that had no way to be said before: an empty metric list
|
|
|
|
| 2541 |
if not report["reconciliation"]["ok"]]}
|
| 2542 |
|
| 2543 |
|
| 2544 |
+
# The share sync writes one grant per changed database, so a save starts writing only with this left.
|
| 2545 |
+
_PERMS_WRITE_RESERVE_S = 20.0
|
| 2546 |
+
|
| 2547 |
+
|
| 2548 |
+
def _require_write_budget():
|
| 2549 |
+
"""Refuse before the first write when the request deadline could fall between the two halves."""
|
| 2550 |
+
from core import request_timing
|
| 2551 |
+
try:
|
| 2552 |
+
left = request_timing.remaining_budget()
|
| 2553 |
+
except Exception:
|
| 2554 |
+
left = 0.0
|
| 2555 |
+
if left is not None and left < _PERMS_WRITE_RESERVE_S:
|
| 2556 |
+
raise err(503, "server_busy", "Access was not saved. Try again in a moment.")
|
| 2557 |
+
|
| 2558 |
+
|
| 2559 |
+
def _restore_perms(uname, prior, written):
|
| 2560 |
+
"""Put back the perms block a failed share sync left, unless another save replaced it since."""
|
| 2561 |
+
from core import account_rows
|
| 2562 |
+
|
| 2563 |
+
def _set(reg):
|
| 2564 |
+
current = reg.get(uname)
|
| 2565 |
+
if isinstance(current, dict) and current.get("perms") == written.get("perms"):
|
| 2566 |
+
for field in ("perms", "perms_v"):
|
| 2567 |
+
if field in prior:
|
| 2568 |
+
current[field] = deepcopy(prior[field])
|
| 2569 |
+
else:
|
| 2570 |
+
current.pop(field, None)
|
| 2571 |
+
return reg
|
| 2572 |
+
|
| 2573 |
+
try:
|
| 2574 |
+
account_rows.update(uname, _set, st=users.store)
|
| 2575 |
+
except Exception as exc:
|
| 2576 |
+
import logging
|
| 2577 |
+
logging.getLogger(__name__).warning("Access restore after a failed share sync failed: %s",
|
| 2578 |
+
type(exc).__name__)
|
| 2579 |
+
|
| 2580 |
+
|
| 2581 |
+
def _sync_database_shares(session, uname, before, after, applied=None):
|
| 2582 |
"""R15/C5: explicit ut_* access grants editor authority; explicit off removes the share.
|
| 2583 |
|
| 2584 |
+
`applied`, when given, collects `(key, entries before, entries stored)` per write, so a
|
| 2585 |
+
caller whose save fails later can revert exactly these grants.
|
| 2586 |
+
|
| 2587 |
Two doors answer two questions: the access rule decides WHICH rows, a `core.shares` `database`
|
| 2588 |
grant decides IF the member sees and edits it, so the editor's toggle writes both. Re-saving
|
| 2589 |
an enabled entry repairs old view-only grants. Other principals, owners and provenance stay
|
|
|
|
| 2623 |
if now:
|
| 2624 |
entries.append({**(held[0] if held else {}), "user": uname, "role": "edit"})
|
| 2625 |
try:
|
| 2626 |
+
stored = shares.set_grants("database", key, entries, st=session.runtime,
|
| 2627 |
+
granter=session.uname, expect=record["entries"])
|
| 2628 |
except shares.GrantsChanged as exc:
|
| 2629 |
raise err(409, "shares_changed", "Database sharing changed. Save access again.") from exc
|
| 2630 |
+
if applied is not None:
|
| 2631 |
+
applied.append((key, record["entries"], stored["entries"]))
|
| 2632 |
+
|
| 2633 |
+
|
| 2634 |
+
def _revert_shares(session, applied):
|
| 2635 |
+
"""Undo the grants a failed save wrote, newest first, each only while it still holds them."""
|
| 2636 |
+
from core import shares
|
| 2637 |
+
|
| 2638 |
+
for key, before, written in reversed(applied):
|
| 2639 |
+
try:
|
| 2640 |
+
shares.set_grants("database", key, before, st=session.runtime, expect=written)
|
| 2641 |
+
except Exception as exc:
|
| 2642 |
+
import logging
|
| 2643 |
+
logging.getLogger(__name__).warning("Grant revert after a failed save failed: %s",
|
| 2644 |
+
type(exc).__name__)
|
| 2645 |
|
| 2646 |
|
| 2647 |
def _set_database_request_share(session, key, entries, held, snapshot):
|
|
|
|
| 2912 |
# control for it: a report that lives only in a client this ticket does not own would be a
|
| 2913 |
# feature nobody ships [[two-lanes-one-contract-dead-feature]].
|
| 2914 |
_stale = {}
|
| 2915 |
+
prior = deepcopy(reg[uname])
|
| 2916 |
+
# Without the snapshot each database re-read the roster and schema: about 44 s on live, past
|
| 2917 |
+
# the 45 s request deadline, so the save failed after the perms block was written.
|
| 2918 |
cleaned = _clean_perms(body.get("perms"),
|
| 2919 |
governed_keys={m["key"] for m in _mods}, session=session,
|
| 2920 |
+
stored=reg[uname].get("perms"), stale_out=_stale,
|
| 2921 |
+
fields_session=_perms_read_snapshot(session, reg),
|
| 2922 |
+
vocabulary_memo={}) or {}
|
| 2923 |
governed = {m["key"] for m in _mods}
|
| 2924 |
opaque = {key: entry for key, entry in cleaned.items() if key not in governed}
|
| 2925 |
known = _fold_legacy_scope(reg[uname],
|
|
|
|
| 2927 |
session=session)
|
| 2928 |
_guard_bu_widening(reg[uname], known, bool(body.get("confirm_widen")))
|
| 2929 |
cleaned = dict(known, **opaque)
|
| 2930 |
+
_require_write_budget()
|
| 2931 |
users.set_access(uname, perms=cleaned)
|
| 2932 |
fresh = _registry()
|
| 2933 |
rec = fresh.get(uname) or {}
|
|
|
|
| 2936 |
# the wall is up when it is not β the one direction this must never fail in.
|
| 2937 |
raise err(503, "store_unavailable",
|
| 2938 |
"the permissions were not saved; the account is UNCHANGED")
|
| 2939 |
+
applied = []
|
| 2940 |
+
try:
|
| 2941 |
+
_sync_database_shares(session, uname, prior.get("perms") or {},
|
| 2942 |
+
{key: entry for key, entry in (rec.get("perms") or {}).items()
|
| 2943 |
+
if key in governed}, applied=applied)
|
| 2944 |
+
except Exception:
|
| 2945 |
+
# Both halves land or neither: undo this save's grants, then put the old block back. If
|
| 2946 |
+
# those writes fail too, the grant repair in `get_perms` and at boot follows the ticks.
|
| 2947 |
+
_revert_shares(session, applied)
|
| 2948 |
+
_restore_perms(uname, prior, rec)
|
| 2949 |
+
raise
|
| 2950 |
return {"username": uname, "perms": rec.get("perms") or {},
|
| 2951 |
"perms_v": int(rec.get("perms_v") or 0),
|
| 2952 |
# W46-T35 β `{module: [key, ...]}`, empty on an ordinary save. What the save cleared
|
platform/core/shares.py
CHANGED
|
@@ -598,7 +598,7 @@ def reconcile_database_grants(st=None, *, tenant=None, table_keys=None):
|
|
| 598 |
def _pending(data):
|
| 599 |
if not isinstance(data, dict) or not isinstance(data.get('database', {}), dict):
|
| 600 |
raise RuntimeError('database sharing is unavailable')
|
| 601 |
-
registry =
|
| 602 |
if not isinstance(registry, dict):
|
| 603 |
raise RuntimeError('the account registry is unavailable')
|
| 604 |
database = data.get('database', {})
|
|
@@ -692,6 +692,18 @@ def reconcile_database_grants(st=None, *, tenant=None, table_keys=None):
|
|
| 692 |
return repaired[0]
|
| 693 |
|
| 694 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 695 |
def repair_published_database_grants(st=None, *, table_keys):
|
| 696 |
"""Attempt one repair after publication, deferring failures to boot/editor except freeze refusal."""
|
| 697 |
from core import freeze_notice
|
|
|
|
| 598 |
def _pending(data):
|
| 599 |
if not isinstance(data, dict) or not isinstance(data.get('database', {}), dict):
|
| 600 |
raise RuntimeError('database sharing is unavailable')
|
| 601 |
+
registry = _strict_accounts()
|
| 602 |
if not isinstance(registry, dict):
|
| 603 |
raise RuntimeError('the account registry is unavailable')
|
| 604 |
database = data.get('database', {})
|
|
|
|
| 692 |
return repaired[0]
|
| 693 |
|
| 694 |
|
| 695 |
+
def _strict_accounts():
|
| 696 |
+
"""Every account record, read strictly: the account rows on PostgreSQL, else the users document."""
|
| 697 |
+
from core import account_rows, users
|
| 698 |
+
# On PostgreSQL the users document is a layout marker; reading it repairs no account at all.
|
| 699 |
+
if account_rows._pg_source(users.store):
|
| 700 |
+
return dict(account_rows._all(users.store))
|
| 701 |
+
registry = users.store._read_strict('users')
|
| 702 |
+
if account_rows.is_marker(registry):
|
| 703 |
+
raise RuntimeError('the account registry is unavailable')
|
| 704 |
+
return registry
|
| 705 |
+
|
| 706 |
+
|
| 707 |
def repair_published_database_grants(st=None, *, table_keys):
|
| 708 |
"""Attempt one repair after publication, deferring failures to boot/editor except freeze refusal."""
|
| 709 |
from core import freeze_notice
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
d03946a215472c6e75fbc1d9880be678cb38041943dc6b80ffc45736e11aba66
|