Skip to content

Fix production network issues on app.simplemodule.dev#109

Merged
antosubash merged 2 commits intomainfrom
feature/agitated-curran
Apr 15, 2026
Merged

Fix production network issues on app.simplemodule.dev#109
antosubash merged 2 commits intomainfrom
feature/agitated-curran

Conversation

@antosubash
Copy link
Copy Markdown
Owner

Summary

Live probing of https://app.simplemodule.dev surfaced three user-visible network problems; this PR fixes all three:

  • /swagger 404 — the Dashboard landing advertises an API Docs link but Swagger UI is only mounted in Development. The isDevelopment prop is already available at the endpoint; threaded through DashboardView and used to gate both the card and the footer link.
  • /favicon.ico 404 on every page loadwwwroot only ships favicon.svg; browsers still auto-fetch the .ico path. Added a small MapGet("/favicon.ico") in the host that serves the existing SVG bytes with image/svg+xml.
  • Sidebar shows Files and Datasets to users who can't open them — both endpoints are gated with .RequirePermission(...) but MenuItem only had a Roles filter, so the menu was incoherent with authorization and every click 302'd to AccessDenied. Added:
    • MenuItem.RequiredPermission (nullable string).
    • ClaimsPrincipal.HasPermission(permission) extension — admin bypass + exact match + wildcard via existing PermissionMatcher.
    • InertiaLayoutDataMiddleware now filters menus by both role and permission in a single compound predicate.
    • FileStorageModule and DatasetsModule set RequiredPermission = XxxPermissions.View on their sidebar entries.
    • PermissionAuthorizationHandler now delegates to HasPermission so the admin-bypass + wildcard-match logic lives in one place.
    • The "permission" claim type string is lifted to a new WellKnownClaims.Permission constant and used in both call sites.

No menu change needed for Map/Layer Sources, Products, Chat, Orders, or Settings — those endpoints are AllowAnonymous() or accept any authenticated user. Admin and PageBuilder were already role-gated.

Test plan

  • dotnet build — clean
  • dotnet test tests/SimpleModule.Core.Tests — 259/259 pass (includes 6 new HasPermission tests and the existing PermissionAuthorizationHandler tests that exercise the refactored delegation)
  • dotnet test modules/FileStorage/tests/SimpleModule.FileStorage.Tests — 44/44
  • dotnet test modules/Datasets/tests/SimpleModule.Datasets.Tests — 4/4
  • After deploy: sign in as the seeded User — sidebar should no longer show Files or Datasets; dashboard cards should not include API Docs; curl -I https://app.simplemodule.dev/favicon.ico should return 200
  • After deploy: sign in as the seeded Admin — Files and Datasets should appear and open without AccessDenied

Live probing of the deployed site surfaced three user-visible 404s /
dead links:

- Dashboard landing cards and footer advertise /swagger, which is only
  mounted in Development. Thread isDevelopment through DashboardView and
  gate both links.
- /favicon.ico 404s on every page load because wwwroot only ships
  favicon.svg. Add a host-level route that serves the SVG at the .ico
  path with the correct content-type.
- Sidebar shows Files and Datasets to authenticated users without the
  required permission, routing them into AccessDenied on click.
  MenuItem.Roles was the only filter; the view endpoints use
  .RequirePermission(). Add MenuItem.RequiredPermission, a reusable
  ClaimsPrincipal.HasPermission extension (admin bypass + exact +
  wildcard via existing PermissionMatcher), filter menus on it in
  InertiaLayoutDataMiddleware, and set the permission on the two
  offending menu entries. PermissionAuthorizationHandler now delegates
  to HasPermission so the logic lives in one place, and the "permission"
  claim type is lifted to WellKnownClaims.Permission.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 15, 2026

Deploying simplemodule-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: fc6574e
Status: ✅  Deploy successful!
Preview URL: https://b608eddd.simplemodule-website.pages.dev
Branch Preview URL: https://feature-agitated-curran.simplemodule-website.pages.dev

View logs

@antosubash antosubash merged commit b2e2478 into main Apr 15, 2026
5 checks passed
@antosubash antosubash deleted the feature/agitated-curran branch April 15, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant