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

[Feature]: Set or change resources and pages after login #1591

Closed
mattrochon opened this issue Dec 8, 2023 · 2 comments
Closed

[Feature]: Set or change resources and pages after login #1591

mattrochon opened this issue Dec 8, 2023 · 2 comments

Comments

@mattrochon
Copy link

Description

I'd like to be able to set, or change the list of resources and pages for a user once they log in to the app. This would allow me to customize the experience for different user roles.

Alternatively, if there was 'isAccessible' functionality associated with pages, that would work too.

Suggested Solution

either a way to update the resources/pages list per user, after they log in

or

pages support isAccessible functionality

Alternatives

I could handle this int he page handler, but the link would still exist in the nav and thats not a great UX

Additional Context

No response

@dziraf
Copy link
Contributor

dziraf commented Dec 11, 2023

For resources you can define isAccessible in list action to hide them from the sidebar.

For pages, you can override SidebarPages component and filter out pages based on currentAdmin (const [currentAdmin] = useCurrentAdmin()):
https://github.com/SoftwareBrothers/adminjs/blob/master/src/frontend/components/app/sidebar/sidebar-pages.tsx

I agree that isAccessible for pages would be ideal. There had been a pull request that was supposed to introduce it but it wasn't ready to merge and it's author eventually stopped working on it:

#1262

@mattrochon
Copy link
Author

Yea I overrode sidebar to make my custom left nav menu, just thought that isAccessible would be alot more consistent witht he adminjs pattern. Thanks for the response!

@dziraf dziraf closed this as completed Mar 21, 2024
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

No branches or pull requests

2 participants