Feature: page access groups with RBAC-based visibility control#727
Open
Plattenspatz wants to merge 1 commit into
Open
Feature: page access groups with RBAC-based visibility control#727Plattenspatz wants to merge 1 commit into
Plattenspatz wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds access groups to Kener — a flexible, RBAC-based mechanism to control who can see which status pages. It enables multi-tenant setups where different customers or teams only see their own pages.
Instead of a simple public/internal toggle, access groups provide a unified model: a built-in
publicgroup controls whether a page is publicly visible, while custom groups (e.g.customer-a,customer-b) restrict access to users whose role includes that group. This keeps things simple for basic setups (everything is public by default) while supporting complex scenarios when needed.Motivation
This was built for a multi-tenant use case: a single Kener instance serving status pages for multiple customers, where each customer should only see their own pages. Currently, all pages are visible to everyone who knows the URL.
Resolves #725.
Related to #714 and #697 — this PR takes a different approach by building on the RBAC system (v4.0.23) rather than adding a binary internal/public flag. The
publicaccess group replaces the need for a separatepage_is_internalfield, and the same mechanism handles both public visibility and per-user filtering.How It Works
Access groups on pages
Each page can have one or more access groups assigned. Two system groups exist by default:
public— pages with this group are visible to everyone without login (current default behavior)admin— roles with this group can see all pages regardless of their groupsCustom groups (e.g.
customer-a) are created by admins and assigned to pages and roles as needed.Access check logic
Example
customer-a-status,shared-infra, andpublic-statuscustomer-b-status,shared-infra, andpublic-statuspublic-statusWhat's Included
Database
access_groups,page_access_groups(page ↔ group),role_access_groups(role ↔ group)publicandadminare seeded automatically and cannot be deletedpublicgroup on migration (backward compatible — nothing changes for existing installations)adminrole gets theadmingroup on migrationBackend
(kener)/+page.server.tsand(kener)/[page_path]/+page.server.tsapi-server/pages/get.ts)autoPublicPages— when enabled (default), newly created pages automatically get thepublicgroupAdmin UI
REST API (
/api/v4/)GET /api/v4/pagesandGET /api/v4/pages/{path}— response includesaccess_groupsarrayPOST /api/v4/pages— accepts optionalaccess_groupsarray (falls back to auto-public setting when omitted)PATCH /api/v4/pages/{path}— acceptsaccess_groupsarray to replace current assignments (omitting it leaves groups unchanged)GET /api/v4/access-groups— list all access groupsPOST /api/v4/access-groups— create a new access groupBackward Compatibility
This PR is fully backward compatible:
publicgroup during migration, so they remain visible to everyoneadminrole automatically gets theadmingroup, giving it access to all pagesaccess_groupsis an additive field in API responsesFiles Changed
Total: ~1,130 lines added across 18 files.
Testing
Tested on two independent instances (fresh install + existing installation with data) covering: