Repository navigation
Inherited and site-default page gating, gated media (#157) - #158
Merged
Merged
Conversation
A page's roles: now applies to everything beneath it, and site.auth.default_roles gates every page that neither declares nor inherits a rule. Precedence: own roles, nearest ancestor, site default. roles: public opts a page or section out. - Resolve the effective rule once over the page index (applyGatingInheritance); PageIndex.ownRoles keeps the declaration so the pass re-runs cleanly. loadPage exposes the effective rule as frontmatter.roles, so every existing gate picks it up. - Translations take the section rule from the same language, else another; a gate beats public when languages disagree. - A malformed roles value inherits instead of opening the page. - roles: any now means any logged-in user (was read as a role "any"). - /content-media/* applies the owning page's rule (404, private no-store); it checked nothing before. Fixes #157 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… site default findPagesForContentMediaPath rebuilt a directory map over every page on each /content-media request; it is now built once per page array. A file with no owning page falls under site.auth.default_roles when set. Changelog notes the roles: any breaking edge. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…o login Subresources and every other denial stay 404. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Nov 12, 2026
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.
Fixes #157
What
roles:applies to everything beneath it, in every language.site.auth.default_roles(same values asroles:, e.g.any) gates every page that neither declares nor inherits a rule.roles: publicopens a page or a whole section.roles:, then nearest ancestor, then site default./auth/*and theme assets are never gated./content-media/*now applies the owning page's rule (404,private, no-store). It checked nothing before; the route-based media path already did.How
One pass over the page index (
applyGatingInheritance) resolves each page's effective rule intoPageIndex.gated/roles;PageIndex.ownRoleskeeps the declaration so the pass re-runs cleanly.loadPageexposes the effective rule asfrontmatter.roles, so the existing gates (routes, API handlers, nav, sitemap, media) pick it up unchanged.Behaviour worth reviewing
public(fails closed).roles:value now inherits instead of opening the page.roles: anynow means any logged-in user, as documented. It was read as a role literally namedany.Not in this PR
Docs live in the
dune-docssubmodule; the "no directory-level config" paragraph in the content-gating page needs updating at the docs step.Testing
deno lint src/anddeno checkclean.any, password login, oneroles: publicsection): anonymous requests redirect to login or 404 on media, public pages and/auth/loginstay open, a logged-in user reaches everything, gated media isprivate, no-store.🤖 Generated with Claude Code