Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/routes_app_dashboard.py +27 -1
- platform/core/module_tables.py +7 -1
- platform/core/perm_scope.py +24 -0
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "27a0370c25",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
27a0370c25
|
api/routes_app_dashboard.py
CHANGED
|
@@ -36,8 +36,34 @@ def _app_source_admission(user, runtime, app_id, source):
|
|
| 36 |
and source in (*template['sources'], *template.get('optional_sources', ())))
|
| 37 |
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
register_app_source_admission(_app_source_admission)
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
def source_scope_for(session, app):
|
|
|
|
| 36 |
and source in (*template['sources'], *template.get('optional_sources', ())))
|
| 37 |
|
| 38 |
|
| 39 |
+
def _app_table_admission(user, runtime, sources):
|
| 40 |
+
"""R62: a module table opens to a holder of one live App that declares all its sources."""
|
| 41 |
+
import application_registry
|
| 42 |
+
import app_templates
|
| 43 |
+
from core import perms
|
| 44 |
+
tenant = getattr(runtime, 'key', None)
|
| 45 |
+
if not tenant or user.get('tenant') != tenant or not user.get('username'):
|
| 46 |
+
return False
|
| 47 |
+
enabled = (getattr(getattr(runtime, 'tenant', None), 'config', None) or {}).get('modules', 'all')
|
| 48 |
+
if enabled != 'all' and (not isinstance(enabled, (list, tuple, set, frozenset))
|
| 49 |
+
or any(source not in enabled for source in sources)):
|
| 50 |
+
return False
|
| 51 |
+
admin = perms.is_admin(user)
|
| 52 |
+
for app in application_registry.load(runtime, strict=True)['applications'].values():
|
| 53 |
+
if (not isinstance(app, dict) or app.get('tenant') != tenant or app.get('retired') is True
|
| 54 |
+
or not application_registry.may_read(app, user['username'], admin)):
|
| 55 |
+
continue
|
| 56 |
+
kind = app.get('templateKind')
|
| 57 |
+
template = app_templates.BY_KIND.get(kind)
|
| 58 |
+
if (template and not app_templates.held(kind)
|
| 59 |
+
and set(sources) <= {*template['sources'], *template.get('optional_sources', ())}):
|
| 60 |
+
return True
|
| 61 |
+
return False
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
from core.perm_scope import register_app_source_admission, register_app_table_admission
|
| 65 |
register_app_source_admission(_app_source_admission)
|
| 66 |
+
register_app_table_admission(_app_table_admission)
|
| 67 |
|
| 68 |
|
| 69 |
def source_scope_for(session, app):
|
platform/core/module_tables.py
CHANGED
|
@@ -296,13 +296,19 @@ def source_refusal(user, table_key, st=None, *, skip=False):
|
|
| 296 |
return None
|
| 297 |
from core import perm_scope
|
| 298 |
token = _CHECKING.set(checking | {key})
|
|
|
|
| 299 |
try:
|
| 300 |
for source in sources:
|
| 301 |
definition = (ut.get_definition(source, st)
|
| 302 |
if source.startswith(ut.KEY_PREFIX) else None)
|
| 303 |
name = _source_name(source, definition)
|
| 304 |
if not perm_scope.may_read(user, source, st=st):
|
| 305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
declared = perm_scope.entry(user, source) or {}
|
| 307 |
row_scope = (f"This table derives from {name}, "
|
| 308 |
f"and a row scope limits your access to {name}.")
|
|
|
|
| 296 |
return None
|
| 297 |
from core import perm_scope
|
| 298 |
token = _CHECKING.set(checking | {key})
|
| 299 |
+
app_held = None
|
| 300 |
try:
|
| 301 |
for source in sources:
|
| 302 |
definition = (ut.get_definition(source, st)
|
| 303 |
if source.startswith(ut.KEY_PREFIX) else None)
|
| 304 |
name = _source_name(source, definition)
|
| 305 |
if not perm_scope.may_read(user, source, st=st):
|
| 306 |
+
# R62: an App's computed rows reach anyone granted the App; the raw source stays
|
| 307 |
+
# walled. A source's row filter or hidden field below still refuses.
|
| 308 |
+
if app_held is None:
|
| 309 |
+
app_held = perm_scope.app_holds_sources(user, sources, st=st)
|
| 310 |
+
if not app_held:
|
| 311 |
+
return f"This table derives from {name}, and your account cannot read {name}."
|
| 312 |
declared = perm_scope.entry(user, source) or {}
|
| 313 |
row_scope = (f"This table derives from {name}, "
|
| 314 |
f"and a row scope limits your access to {name}.")
|
platform/core/perm_scope.py
CHANGED
|
@@ -2616,6 +2616,30 @@ def register_app_source_admission(adapter):
|
|
| 2616 |
_APP_SOURCE_ADMISSION = adapter
|
| 2617 |
|
| 2618 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2619 |
def scoped_app_source(user, table_key, *, st, app_id, records=None):
|
| 2620 |
"""Apply the ordinary field and row walls after guarded live App admission."""
|
| 2621 |
key = str(table_key or '').strip()
|
|
|
|
| 2616 |
_APP_SOURCE_ADMISSION = adapter
|
| 2617 |
|
| 2618 |
|
| 2619 |
+
_APP_TABLE_ADMISSION = None
|
| 2620 |
+
|
| 2621 |
+
|
| 2622 |
+
def register_app_table_admission(adapter):
|
| 2623 |
+
"""Register the API's adapter: does a reader hold one live App declaring every source."""
|
| 2624 |
+
if not callable(adapter):
|
| 2625 |
+
raise TypeError('App table admission requires a callable adapter')
|
| 2626 |
+
global _APP_TABLE_ADMISSION
|
| 2627 |
+
_APP_TABLE_ADMISSION = adapter
|
| 2628 |
+
|
| 2629 |
+
|
| 2630 |
+
def app_holds_sources(user, sources, *, st):
|
| 2631 |
+
"""R62: True when `user` holds one live App whose template declares every source. Fails closed."""
|
| 2632 |
+
tenant = getattr(st, 'key', None)
|
| 2633 |
+
sources = tuple(sources or ())
|
| 2634 |
+
if (_APP_TABLE_ADMISSION is None or not tenant or not sources or not isinstance(user, dict)
|
| 2635 |
+
or not user.get('username') or user.get('tenant') != tenant):
|
| 2636 |
+
return False
|
| 2637 |
+
try:
|
| 2638 |
+
return _APP_TABLE_ADMISSION(user, st, sources) is True
|
| 2639 |
+
except Exception:
|
| 2640 |
+
return False
|
| 2641 |
+
|
| 2642 |
+
|
| 2643 |
def scoped_app_source(user, table_key, *, st, app_id, records=None):
|
| 2644 |
"""Apply the ordinary field and row walls after guarded live App admission."""
|
| 2645 |
key = str(table_key or '').strip()
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
e736d2bf538080e433766deb4e30b47fbd86152c75791ccdc0809bb21da4c4e9
|