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

feat(@casl/react): Pass forbidden reason message to child render function #973

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

paulleonartcalvo
Copy link

@paulleonartcalvo paulleonartcalvo commented Sep 19, 2024

Addresses #972

  • Passes a third forbiddenReason to the Can child render function to facilitate displaying reasons in the UI without having to repeat condition checking.
  • Adds throwUnlessCannot and unlessCannot functions to ForbiddenError to facilitate logic and provide a mirror for the cannot circumstance
  • Adds a public inverted field to indicate whether the error was produced via unlessCan or unlessCannot. inverted is true when the error was produced via unlessCannot similar to how ability.cannot() rules are inverted.

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

Successfully merging this pull request may close these issues.

1 participant