Skip to content

v1.0.5

Latest

Choose a tag to compare

@FlorentinLedy FlorentinLedy released this 06 Dec 09:47

v1.0.5 - Multi-Entity Support and Strict Mode Validation 馃弳

Summary

This release introduces the ability to check authorization against multiple entities at once, providing greater flexibility and control in defining user access. AuthorizedContent can now operate in a "multi-entity" mode, allowing you to pass an array of entities鈥攅ach with its own entityId, entityType, and relationship鈥攖o be checked. The component will render its children if the user has the required relationship with at least one of the specified entities.

In addition, the component enforces that you cannot use both "single-entity" and "multi-entity" modes at the same time. If both sets of props are provided, a warning will be logged and no content will be rendered, ensuring a more predictable and maintainable setup.

Key Features

  • Multi-Entity Mode: Pass an array of entities (each defined by entityId, entityType, and relationship) to AuthorizedContent to check for user access against multiple entities.
  • Strict Mode Validation: AuthorizedContent now warns and prevents rendering if you attempt to use both the single-entity props (entityId, entityType, relationship) and the entities array simultaneously.
  • Continued Support for Loading States: The optional loading prop is still available to handle asynchronous loading of user entities gracefully.

This update simplifies complex authorization scenarios and enforces best practices, ensuring a clearer and more robust approach to rendering authorized content in your application.