Paozhu logoPaozhu Docs
Documentation
OPS

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

conf/server.confini
[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 = 16777216

Domain controller directories

controller/src/aaa.com/article.cppcpp
// 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

  1. Superadmin creates a site

    Writes siteinfo.agentid and creates the directory from basesitepath + sitepath.

  2. Backfill userid

    After saving, userid = sid becomes the tenant ID.

  3. Create tenant admin

    sysuser.companyid = sid.

  4. Login writes session

    session["userid"] = companyid and session["adminid"] = adminid.

  5. RBAC narrowing

    The grant chain is filtered by companyid and intersected with platform allocations.

Supported vs. bring your own

CapabilityStatus
Multi-domain / multi-siteSupported
Theme path isolationSupported via theme_view
Tenant RBACSupported with exact mask matching
Row-level data isolationMust be implemented in business queries
Self-service signup / billingNot implemented
Per-tenant databaseNot implemented; current model is shared schema