Files
marqdo/examples/web-tenant-saas/index.mq.md
T
cflmyandCursor 5cf84fe9b7 feat(web): RBAC, tenant scope, and WS room hooks
Add configurable role⊥permission (five tables, gate permissions, register,
/_rbac desk), multi-tenant path/header resolution with JSON tenant_scope,
and route_ws on_message/presence/dynamic room_key — with author surfaces,
demos, and smokes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 20:54:02 +08:00

1.1 KiB


title: web-tenant-saas demo description: Dual-tenant isolation via ?t= query + tenant_scope JSON API. import web:ext/web/web.mq.md

main

items_schema =

name type nullable
id integer false
title text false
tenant_id text false

api =

path method table order limit tenant_scope
api/items GET items id 50 true

db = > web.db url="sqlite:data/tenant-saas.db"

db.init name=items fields=items_schema db.exec sql="DELETE FROM items" db.exec sql="INSERT INTO items(title, tenant_id) VALUES('Acme note','acme')" db.exec sql="INSERT INTO items(title, tenant_id) VALUES('Beta note','beta')"

page = > web.page title="Tenant SaaS" intro="

Try /api/items?t=acme vs /api/items?t=beta.

" app = > web.app page=page db=db host="127.0.0.1" port=18092 admin=False app = > app.tenant mode="path" param="t" default_scope=False app = > app.configure json=api

app.listen