Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/routes_app_dashboard.py +16 -3
- api/routes_sheet.py +21 -11
- platform/core/module_tables.py +1 -1
- platform/core/perm_scope.py +3 -3
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "d6c7d76731",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
d6c7d76731
|
api/routes_app_dashboard.py
CHANGED
|
@@ -36,14 +36,27 @@ def _app_source_admission(user, runtime, app_id, source):
|
|
| 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
|
| 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)):
|
|
@@ -55,7 +68,7 @@ def _app_table_admission(user, runtime, sources):
|
|
| 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
|
|
|
|
| 36 |
and source in (*template['sources'], *template.get('optional_sources', ())))
|
| 37 |
|
| 38 |
|
| 39 |
+
def _app_table_admission(user, runtime, table_key, sources):
|
| 40 |
+
"""R62: a module table opens to its owning App's holder when that App declares every source."""
|
| 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 |
+
owner_kind = {
|
| 48 |
+
'ut_amazon_aged_stock': 'aged_stock',
|
| 49 |
+
'ut_amazon_restock': 'restock_planner',
|
| 50 |
+
'ut_amazon_payouts': 'payouts',
|
| 51 |
+
'ut_amazon_fee_checks': 'payouts',
|
| 52 |
+
'ut_amazon_reimbursement_claims': 'reimbursements',
|
| 53 |
+
'ut_amazon_reimbursements_paid': 'reimbursements',
|
| 54 |
+
'ut_amazon_returns': 'returns_refunds',
|
| 55 |
+
'ut_amazon_return_reasons': 'returns_refunds',
|
| 56 |
+
'ut_amazon_return_items': 'returns_refunds',
|
| 57 |
+
}.get(table_key)
|
| 58 |
+
if not owner_kind:
|
| 59 |
+
return False
|
| 60 |
enabled = (getattr(getattr(runtime, 'tenant', None), 'config', None) or {}).get('modules', 'all')
|
| 61 |
if enabled != 'all' and (not isinstance(enabled, (list, tuple, set, frozenset))
|
| 62 |
or any(source not in enabled for source in sources)):
|
|
|
|
| 68 |
continue
|
| 69 |
kind = app.get('templateKind')
|
| 70 |
template = app_templates.BY_KIND.get(kind)
|
| 71 |
+
if (kind == owner_kind and template and not app_templates.held(kind)
|
| 72 |
and set(sources) <= {*template['sources'], *template.get('optional_sources', ())}):
|
| 73 |
return True
|
| 74 |
return False
|
api/routes_sheet.py
CHANGED
|
@@ -45,7 +45,7 @@ import threading
|
|
| 45 |
import uuid
|
| 46 |
from collections import OrderedDict
|
| 47 |
|
| 48 |
-
from fastapi import APIRouter, Body, Depends, File, HTTPException, Query, UploadFile
|
| 49 |
from fastapi.responses import Response
|
| 50 |
|
| 51 |
from deps import Session, err, require_session
|
|
@@ -2854,8 +2854,22 @@ def list_sheets(session: Session = Depends(require_session)):
|
|
| 2854 |
return {"workbooks": _wire_shares(rows)}
|
| 2855 |
|
| 2856 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2857 |
@router.post("/sheets", status_code=201)
|
| 2858 |
-
def create_sheet(body: dict = Body(default=None), session: Session = Depends(require_session)
|
|
|
|
| 2859 |
"""Create a workbook with exactly one tab (R7)."""
|
| 2860 |
from core import sheets
|
| 2861 |
raw = dict(body or {})
|
|
@@ -2866,15 +2880,11 @@ def create_sheet(body: dict = Body(default=None), session: Session = Depends(req
|
|
| 2866 |
on_duplicate="refuse")
|
| 2867 |
except sheets.SheetRefusal as exc:
|
| 2868 |
raise _refuse(exc)
|
| 2869 |
-
|
| 2870 |
-
|
| 2871 |
-
|
| 2872 |
-
|
| 2873 |
-
|
| 2874 |
-
except Exception:
|
| 2875 |
-
# A projection failure must not turn a committed creation into a failed request.
|
| 2876 |
-
import logging
|
| 2877 |
-
logging.getLogger(__name__).error("Sheet wiki notification failed after persistence")
|
| 2878 |
return {"workbook": _response_workbook(book)}
|
| 2879 |
|
| 2880 |
|
|
|
|
| 45 |
import uuid
|
| 46 |
from collections import OrderedDict
|
| 47 |
|
| 48 |
+
from fastapi import APIRouter, BackgroundTasks, Body, Depends, File, HTTPException, Query, UploadFile
|
| 49 |
from fastapi.responses import Response
|
| 50 |
|
| 51 |
from deps import Session, err, require_session
|
|
|
|
| 2854 |
return {"workbooks": _wire_shares(rows)}
|
| 2855 |
|
| 2856 |
|
| 2857 |
+
def _record_workbook_created(session, book):
|
| 2858 |
+
"""Project a committed blank workbook into the generated wiki log; never raises."""
|
| 2859 |
+
try:
|
| 2860 |
+
import wiki_log
|
| 2861 |
+
wiki_log.record_build(session, kind="workbook", object_id=book["id"],
|
| 2862 |
+
event_id="workbook:" + book["id"] + ":created",
|
| 2863 |
+
occurred_at=book["created_at"])
|
| 2864 |
+
except Exception:
|
| 2865 |
+
# A projection failure must not turn a committed creation into a failed request.
|
| 2866 |
+
import logging
|
| 2867 |
+
logging.getLogger(__name__).error("Sheet wiki notification failed after persistence")
|
| 2868 |
+
|
| 2869 |
+
|
| 2870 |
@router.post("/sheets", status_code=201)
|
| 2871 |
+
def create_sheet(body: dict = Body(default=None), session: Session = Depends(require_session),
|
| 2872 |
+
background: BackgroundTasks = None):
|
| 2873 |
"""Create a workbook with exactly one tab (R7)."""
|
| 2874 |
from core import sheets
|
| 2875 |
raw = dict(body or {})
|
|
|
|
| 2880 |
on_duplicate="refuse")
|
| 2881 |
except sheets.SheetRefusal as exc:
|
| 2882 |
raise _refuse(exc)
|
| 2883 |
+
# The wiki rebuild costs seconds per create, so the HTTP door runs it after the response.
|
| 2884 |
+
if background is None:
|
| 2885 |
+
_record_workbook_created(session, book)
|
| 2886 |
+
else:
|
| 2887 |
+
background.add_task(_record_workbook_created, session, book)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2888 |
return {"workbook": _response_workbook(book)}
|
| 2889 |
|
| 2890 |
|
platform/core/module_tables.py
CHANGED
|
@@ -306,7 +306,7 @@ def source_refusal(user, table_key, st=None, *, skip=False):
|
|
| 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 {}
|
|
|
|
| 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, key, 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 {}
|
platform/core/perm_scope.py
CHANGED
|
@@ -2627,15 +2627,15 @@ def register_app_table_admission(adapter):
|
|
| 2627 |
_APP_TABLE_ADMISSION = adapter
|
| 2628 |
|
| 2629 |
|
| 2630 |
-
def app_holds_sources(user, sources, *, st):
|
| 2631 |
-
"""R62:
|
| 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 |
|
|
|
|
| 2627 |
_APP_TABLE_ADMISSION = adapter
|
| 2628 |
|
| 2629 |
|
| 2630 |
+
def app_holds_sources(user, table_key, sources, *, st):
|
| 2631 |
+
"""R62: admit a table through its owning App's grant and complete source declaration."""
|
| 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, table_key, sources) is True
|
| 2639 |
except Exception:
|
| 2640 |
return False
|
| 2641 |
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
dd03de20c9d9311157d8a7045970facaa289d7f8bce35267d5cce5351e3e2777
|