SaaS development mode
How multi-domain sites, per-site themes and tenant-scoped RBAC fit together.
What it is
Paozhu’s SaaS mode is a deployment convention, not a separate product: [domain] sections define sites, siteid/groupid identify tenants, alias_domain maps a domain to a controller directory, and themes selects a view prefix.
Site configuration
[default]
mainhost = www.example.com
wwwpath = ./www/default
global_http2_enable = 1
[cn.aaa.com]
wwwpath = ./www/cn_aaa_com
siteid = 1
groupid = 0
alias_domain = aaa.com
themes = cn
themes_url = /cn/
upload_max_size = 16777216Domain controller directories
// controller/src/aaa.com/article.cpp
namespace http { namespace aaa {
//@urlpath(null,articles)
std::string articles(std::shared_ptr<httppeer> peer)
{
httppeer &client = peer->get_peer();
auto siteid = client.get_siteid();
auto theme = client.get_theme();
client.theme_view("article/list");
return "";
}
}}A first path segment containing a dot (e.g. aaa.com) is treated as a domain directory; the namespace is the part before the dot (aaa). Different domains can each define /articles.
Tenant identity chain
Superadmin creates a site
Writes
siteinfo.agentidand creates the directory frombasesitepath + sitepath.Backfill userid
After saving,
userid = sidbecomes the tenant ID.Create tenant admin
sysuser.companyid = sid.Login writes session
session["userid"] = companyidandsession["adminid"] = adminid.RBAC narrowing
The grant chain is filtered by
companyidand intersected with platform allocations.
Supported vs. bring your own
| Capability | Status |
|---|---|
| Multi-domain / multi-site | Supported |
| Theme path isolation | Supported via theme_view |
| Tenant RBAC | Supported with exact mask matching |
| Row-level data isolation | Must be implemented in business queries |
| Self-service signup / billing | Not implemented |
| Per-tenant database | Not implemented; current model is shared schema |