site_id everywhere: multi-tenancy without leaks
۱۴۰۵/۶/۹1 min read0 views

In one installation serving many sites, the worst bug is one site’s data showing on another. In SimaCMS every row carries a site_id column, spelled the same everywhere.
An error, not a default
Every model has a global scope that narrows a query to the current site. With no site in context, the query throws. A deliberate read across sites has to say so out loud.
Outside a request
Jobs carry their site with them and re-enter it, and console commands loop over the sites one by one.
Comments
Sign in to leave a comment.
Sign inLoading…

