Check permissions for routes accessed via deep-links. - #27427
Draft
dennisoelkers wants to merge 1 commit into
Draft
dennisoelkers wants to merge 1 commit into
dennisoelkers wants to merge 1 commit into
Conversation
Plugin routes could already declare `permissions`, but `AppRouter` never read the field, so any logged-in user who reached the URL directly got the page. Navigation only hid the entries, and the unauthorized page was reactive: it appeared only once an API call happened to return a 403. Wrap plugin routes in a `RoutePermissionGuard` that renders `UnauthorizedErrorPage` when the user lacks the declared permissions, using the same `isPermitted` semantics the navigation uses so a route and its nav entry cannot disagree. `UnauthorizedErrorPage` now takes an optional `error`, since a route level denial has no `FetchError`, plus a `displayPageLayout` pass-through so routes already nested under `PageContentLayout` do not render a second one. Core routes declare no permissions and are unaffected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Description
Motivation and Context
Prior to this PR, we were hiding links (e.g. buttons, items in navigations, ...) to routes that the user has insufficient permissions for, but when the user used a deep-link, we tried to render the change and (usually) failed on the first API call that the user was missing permissions for.
This PR is now making use of already defined permissions for routes to block overall access to them.
/nocl Internal refactoring.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: