Changeset 7e9d0ea in Klonkt
- Timestamp:
- 08/11/2026 07:18:51 PM (4 weeks ago)
- Branches:
- main
- Children:
- bac4bf3
- Parents:
- 960f015
- git-author:
- Robin <roboburr@…> (08/11/2026 07:12:33 PM)
- git-committer:
- Robin <roboburr@…> (08/11/2026 07:18:51 PM)
- Files:
-
- 3 edited
- 1 moved
-
CLAUDE.md (modified) (1 diff)
-
src/config/database.js (modified) (2 diffs)
-
src/services/ensurePrimarySite.js (modified) (2 diffs)
-
test/site-permissions.test.js (moved) (moved from test/hub-permissions.test.js ) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CLAUDE.md
r960f015 r7e9d0ea 63 63 Tests live in `test/*.test.js` and run against an in-memory SQLite 64 64 (`DATABASE_PATH=':memory:'`), so they never touch real data. Cover new 65 permission /tenancylogic with tests — `PermissionsService.canAdminSite` was once66 silently broken; see `test/ hub-permissions.test.js`.65 permission logic with tests — `PermissionsService.canAdminSite` was once 66 silently broken; see `test/site-permissions.test.js`. 67 67 68 68 ## Architecture Overview -
src/config/database.js
r960f015 r7e9d0ea 266 266 `); 267 267 268 // Global app settings (key/value singleton). Includes the tenancy mode 269 // (solo = one site, hub = company site + /user/). Default = solo. 268 // Global app settings (key/value singleton). One instance is one owner, so 269 // there is no tenancy mode here anymore — see SettingsService. 270 // Oudere installaties dragen nog een dode rij key='tenancy' ('solo' of 271 // 'circle'). Niets leest hem; bewust laten staan (shaer-x7c0) in plaats van 272 // er opruimcode voor te schrijven die na één ronde zelf dood is. 270 273 db.exec(` 271 274 CREATE TABLE IF NOT EXISTS app_settings ( … … 275 278 ); 276 279 `); 277 db.prepare("INSERT OR IGNORE INTO app_settings (key, value) VALUES ('tenancy', 'solo')").run();278 280 279 281 // ── Statistics (premium) — cookie-free ────────────────────── -
src/services/ensurePrimarySite.js
r960f015 r7e9d0ea 3 3 4 4 // A Klonkt instance should ALWAYS have a primary site — it carries the identity 5 // (title, theme, profile) and is the anchor point in solo/hub/circle mode.5 // (title, theme, profile) and is the anchor point for the whole instance. 6 6 // The register flow already creates one, but an admin created via a script 7 7 // (or an empty sites table for any reason) left the instance without a site: … … 10 10 // This helper runs at boot (and is idempotent): as soon as there is an admin 11 11 // but no site yet, it creates a default site owned by the first god/admin. 12 // Tenancy-agnostic — applies to solo, hub, and circle.13 12 14 13 function defaultTitle() { -
test/site-permissions.test.js
r960f015 r7e9d0ea 1 // Unit-tests voor de hub-permissielaag — juist `canAdminSite` was lang stil kapot1 // Unit-tests voor de site-permissielaag — juist `canAdminSite` was lang stil kapot 2 2 // (las een nooit-gevulde user.siteRoles), dus dit dekt 'm nu af. Draait op de 3 3 // ingebouwde node:test (geen extra deps). In-memory SQLite → raakt geen echte data. 4 // 5 // Heette hub-permissions.test.js: de hub-modus is weg (72ec6a4), maar wat hier 6 // getest wordt niet. canAdminSite, canEditPost en getPrimarySite zijn springlevend 7 // en dit bestand is hun enige dekking — alleen de naam verwees nog naar de modus. 4 8 // 5 9 // Run: npm test (= node --test)
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)