Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce <NavigateToFirstResource> #10255

Merged
merged 7 commits into from
Oct 3, 2024

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Oct 2, 2024

Problem

In the absence of a dashboard component, the / route redirects to the list view of the first Resource (or the first available list view of all resources).

With the introduction of canAccess, this may lead to an Access Denied page. For instance, if the first resource is a posts list, and the connected user doesn't have the { action: "list", resource: "posts" } permission, they will see the access denied page.

Solution

  1. Use access control to narrow down the possible home pages
  2. Since access control depends on authentication, require authentication for the default / route

This 2. is a slight BC break. In the case of a default list view with disableAuthentiction turned on, anonymous users won't be able to access it. It's an easy fix though: set the <Admin dashboard> to a <Navigate> component to bypass the default route selection.

Additional Checks

  • The PR targets master for a bugfix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

@djhi djhi added the RFR Ready For Review label Oct 2, 2024
@djhi djhi mentioned this pull request Oct 2, 2024
19 tasks
Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

docs/Admin.md Outdated Show resolved Hide resolved
djhi and others added 3 commits October 3, 2024 12:33
Co-authored-by: Francois Zaninotto <francois@marmelab.com>
…eact-admin into access-control-first-resource
@fzaninotto fzaninotto merged commit d1be9bb into access-control-resources Oct 3, 2024
14 checks passed
@fzaninotto fzaninotto deleted the access-control-first-resource branch October 3, 2024 15:53
@fzaninotto fzaninotto added this to the 5.3.0 milestone Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants