Closed mattrochon closed 4 months ago
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:
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!
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