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/deps.py +6 -1
- api/routes_nav.py +7 -0
- platform/core/perm_scope.py +44 -0
- platform/core/perms.py +6 -1
RELEASES.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v29",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "74e86de",
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v29",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
74e86de
|
api/deps.py
CHANGED
|
@@ -60,7 +60,12 @@ class Session:
|
|
| 60 |
that tenant's admin, or a freshly provisioned Nurilab admin (role=admin β may_open
|
| 61 |
everything) would open Royal's Odoo-backed surfaces through any module route. One
|
| 62 |
chokepoint: `module_gate` and every inline `session.require` pass through here."""
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
raise err(403, "forbidden", f"your account does not have access to {module_key}")
|
| 65 |
tcfg = getattr(self.runtime.tenant, "config", None) or {}
|
| 66 |
tmods = tcfg.get("modules", "all")
|
|
|
|
| 60 |
that tenant's admin, or a freshly provisioned Nurilab admin (role=admin β may_open
|
| 61 |
everything) would open Royal's Odoo-backed surfaces through any module route. One
|
| 62 |
chokepoint: `module_gate` and every inline `session.require` pass through here."""
|
| 63 |
+
# β THE SAME PREDICATE THE NAV USES, or the two disagree and the disagreement is
|
| 64 |
+
# invisible: a row the rail offers that the route 403s, or the reverse. The
|
| 65 |
+
# editor's explicit grant lands here too, so a database an administrator ticked
|
| 66 |
+
# is reachable by URL as well as visible in the rail.
|
| 67 |
+
import core.perm_scope as _perm_scope
|
| 68 |
+
if not _perm_scope.nav_may_open(self.user, module_key):
|
| 69 |
raise err(403, "forbidden", f"your account does not have access to {module_key}")
|
| 70 |
tcfg = getattr(self.runtime.tenant, "config", None) or {}
|
| 71 |
tmods = tcfg.get("modules", "all")
|
api/routes_nav.py
CHANGED
|
@@ -489,8 +489,15 @@ def nav(session: Session = Depends(require_session)):
|
|
| 489 |
# the moment this import failed. A sentinel that can equal real data is not a sentinel.
|
| 490 |
_ut_locked_mode = str(user_tables.AUTOMATION_RECORD_MODE)
|
| 491 |
_lent = user_tables.lend(session.runtime, **{user_tables.STORE_KEY: _ut_defs})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 492 |
for e in user_tables.nav_entries(viewer=session.uname, is_admin=session.admin,
|
| 493 |
st=_lent):
|
|
|
|
|
|
|
| 494 |
pages.append({"key": e["key"], "label": e["label"],
|
| 495 |
"source": e.get("source") or "Blank", "chrome": "main"})
|
| 496 |
except Exception:
|
|
|
|
| 489 |
# the moment this import failed. A sentinel that can equal real data is not a sentinel.
|
| 490 |
_ut_locked_mode = str(user_tables.AUTOMATION_RECORD_MODE)
|
| 491 |
_lent = user_tables.lend(session.runtime, **{user_tables.STORE_KEY: _ut_defs})
|
| 492 |
+
# β AND THE EDITOR'S DENY REACHES THIS HALF TOO. `nav_entries` is `may_open`-filtered
|
| 493 |
+
# β creator, admin or a share β which knows nothing about the access toggle in
|
| 494 |
+
# Manage user. An administrator unticking a shared database left it on the rail.
|
| 495 |
+
# `nav_may_open` composes the two and cannot WIDEN past `may_open` on a `ut_*` key.
|
| 496 |
+
import core.perm_scope as _perm_scope
|
| 497 |
for e in user_tables.nav_entries(viewer=session.uname, is_admin=session.admin,
|
| 498 |
st=_lent):
|
| 499 |
+
if not _perm_scope.nav_may_open(session.user, e["key"], st=_lent):
|
| 500 |
+
continue
|
| 501 |
pages.append({"key": e["key"], "label": e["label"],
|
| 502 |
"source": e.get("source") or "Blank", "chrome": "main"})
|
| 503 |
except Exception:
|
platform/core/perm_scope.py
CHANGED
|
@@ -87,6 +87,50 @@ def may_access(user, module):
|
|
| 87 |
return perms.may_open(user, module) # legacy record: the old grant wall
|
| 88 |
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
def assistant_entry(user, module):
|
| 91 |
"""The explicit database grant an Assistant snapshot may rely on, else ``None``.
|
| 92 |
|
|
|
|
| 87 |
return perms.may_open(user, module) # legacy record: the old grant wall
|
| 88 |
|
| 89 |
|
| 90 |
+
def nav_may_open(user, key, st=None):
|
| 91 |
+
"""May this account SEE `key` β in the nav, and at the route gate? The ADMISSION question.
|
| 92 |
+
|
| 93 |
+
ββ WHY THIS EXISTS: THE EDITOR'S DECISION REACHED THE READ DOOR AND NOTHING ELSE. Measured
|
| 94 |
+
on live 2026-08-18, on a real account. An administrator ticked *Odoo products* for Naomi in
|
| 95 |
+
Manage user and saved; the record stored `perms.product_data.access = True` and
|
| 96 |
+
`may_access()` agreed. **The database never appeared.** `perms.nav_pages` and
|
| 97 |
+
`deps.Session.require` both ask `perms.may_open` β the LEGACY `user['modules']` array β which
|
| 98 |
+
still read `['sales', 'customers', 'products']`, and `products` is the key of the ARCHIVED
|
| 99 |
+
*SKU* module, not of `product_data`. So `nav_pages` answered `['customer_data']` and the
|
| 100 |
+
route would have 403'd her even by URL. Two permission systems, the editor writing one and
|
| 101 |
+
every DOOR reading the other ([[two-permission-systems-one-armed]]).
|
| 102 |
+
|
| 103 |
+
β THE ASYMMETRY IS THE WHOLE DESIGN, and it is not the same rule twice:
|
| 104 |
+
|
| 105 |
+
1. an admin sees everything (break-glass, as everywhere else);
|
| 106 |
+
2. an EXPLICIT `access: false` DENIES, on any key β an administrator unticking a box must
|
| 107 |
+
take the row off the nav, and before this it did not;
|
| 108 |
+
3. a `ut_*` key with no explicit deny defers to `user_tables.may_open` β creator, admin or
|
| 109 |
+
a `core.shares` grant β and **an `access: true` entry may NEVER widen past it**. The
|
| 110 |
+
editor must not become a way to hand somebody another user's private table;
|
| 111 |
+
4. a REGISTRY TOPIC with an explicit entry takes that entry, grant included. Here the
|
| 112 |
+
editor IS the authority: `_clean_perms` writes an entry for every governed topic on
|
| 113 |
+
every save, so an entry means an administrator decided;
|
| 114 |
+
5. anything else β a module this editor does not govern β falls through to
|
| 115 |
+
`perms.may_open`, UNCHANGED.
|
| 116 |
+
|
| 117 |
+
β LEG 5 IS LOAD-BEARING AND IT IS WHY `may_access` COULD NOT SIMPLY BE CALLED HERE.
|
| 118 |
+
`may_access` reads migrated-and-undeclared as DENY, which is correct for a governed topic and
|
| 119 |
+
catastrophic for the nav: Naomi's block declares the ten governed keys and nothing else, so
|
| 120 |
+
`sales` would have gone from visible to denied β an outage dressed as a permission fix.
|
| 121 |
+
"""
|
| 122 |
+
if perms.is_admin(user):
|
| 123 |
+
return True
|
| 124 |
+
e = entry(user, key)
|
| 125 |
+
if e is not None and not bool(e.get('access', True)):
|
| 126 |
+
return False
|
| 127 |
+
if str(key or '').startswith(_ut().KEY_PREFIX):
|
| 128 |
+
return bool(_ut().may_open(key, (user or {}).get('username'), False, st=st))
|
| 129 |
+
if e is not None:
|
| 130 |
+
return bool(e.get('access', True))
|
| 131 |
+
return perms.may_open(user, key)
|
| 132 |
+
|
| 133 |
+
|
| 134 |
def assistant_entry(user, module):
|
| 135 |
"""The explicit database grant an Assistant snapshot may rely on, else ``None``.
|
| 136 |
|
platform/core/perms.py
CHANGED
|
@@ -189,7 +189,12 @@ def nav_pages(user):
|
|
| 189 |
# API no longer advertises it as a surface of the PRODUCT.
|
| 190 |
if m['key'] == 'settings':
|
| 191 |
continue
|
| 192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
continue
|
| 194 |
row = {'key': m['key'], 'label': m['label'],
|
| 195 |
'chrome': 'main' if m.get('nav', True) else 'utility'}
|
|
|
|
| 189 |
# API no longer advertises it as a surface of the PRODUCT.
|
| 190 |
if m['key'] == 'settings':
|
| 191 |
continue
|
| 192 |
+
# β `nav_may_open`, NOT `may_open`: the permission editor's explicit decision is
|
| 193 |
+
# what an administrator just made, and until 2026-08-18 it reached the READ door
|
| 194 |
+
# and never this list β a database granted in Manage user, saved and confirmed,
|
| 195 |
+
# simply did not appear. Deferred import because `perm_scope` imports THIS module.
|
| 196 |
+
import core.perm_scope as _perm_scope
|
| 197 |
+
if not _perm_scope.nav_may_open(user, m['key']):
|
| 198 |
continue
|
| 199 |
row = {'key': m['key'], 'label': m['label'],
|
| 200 |
'chrome': 'main' if m.get('nav', True) else 'utility'}
|