Repository navigation
v1.0.0
React ReBAC Release v1.0.0 馃帀
Summary
We are excited to announce the initial release of React ReBAC! This lightweight library brings Relationship-Based Access Control (ReBAC) capabilities to React applications, allowing you to manage access control with ease and flexibility.
Features
- ReBAC Context Provider: Easily integrate the
RebacProviderat the root of your React app to set up access control. - Dynamic Access Management: Set user relationships with different entities and roles, and use hooks to manage access control dynamically.
- Conditional Rendering Component:
AuthorizedContentcomponent enables content to be displayed conditionally based on user relationships and roles. - TypeScript Support: Full TypeScript support, ensuring better type safety and developer experience.
- Flexible Hooks:
useAuthorizationto verify user access to specific entities.useUserEntitiesfor retrieving user entities with ease.
Installation
Install with npm:
npm install react-rebacOr with Yarn:
yarn add react-rebacUsage
Import and wrap your application with RebacProvider, and use the AuthorizedContent component to conditionally render content.
import { RebacProvider, AuthorizedContent, useRebac } from 'react-rebac';
const App: React.FC = () => (
<RebacProvider>
<MainContent />
</RebacProvider>
);
const MainContent: React.FC = () => (
<AuthorizedContent entityId="orgA" entityType="Organization" relationship="Admin">
<h3>Admin Content</h3>
</AuthorizedContent>
);
export default App;Feedback
We would love to hear your feedback! Please open an issue if you encounter any problems or have feature requests.
This release note is ready for a GitHub release and can be adjusted as new features or changes are added to the library.