Making the permission management for React components easier.
react-permissible is a React Component allowing to:
- manage visibility of particular components depending on users permissions
- replace particular component when the user isn't permitted to see it
- manage accessability to particular view depending on users permissions
- fire a callback when the user isn't allowed to go to access the component/route
Currently there's no permission management in React. The existing components are either over-engineered (full ACL support etc.), or limited to role-based management.
react-permissible is simple at its core and solves only one problem. Access the Component if the permissions match, do something otherwise.
npm i @brainhubeu/react-permissible
userPermissionsis an array of permissions set for current user
requiredPermissionsis an array of required permissions
More detailed documentation with several use cases covered is available here.
- Passing a callback function as a prop for
react-permissible is maintained by @kkoscielniak, @adam-golab, @Lukasz-pluszczewski and the Brainhub development team. It is funded by Brainhub and the names and logos for Brainhub are trademarks of Brainhub Sp. z o.o.. You can check other open-source projects supported/developed by our teammates here.