-
Notifications
You must be signed in to change notification settings - Fork 124
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
Create usePermissions
UI hook
#413
Conversation
It might be more versatile to have this hook return the list of permissions for the currently logged in user alongside a few helper functions to help determine if a user has a list of required permissions or at least one from a list of permissions. I could see wanting to use different lists of permissions for different checks on the same page or even within the same component. Instead of needing to call this hook multiple times you could call it once and compute what you needed as needed. What are your thoughts? |
@elikmiller I don't think thats a bad idea at all, we may not even need to return the user's current permissions -- just a set of helper functions that can be called with a list of permissions to match against as the argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning up the permissions callback! 🧹 🧼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Description
usePermissions
hook that checks permissions of the current user against a provided list of permissionsrenderHook
method override for testing library set up in the same way as our customrender
methodMotivation and Context
How Has This Been Tested?
usePermissions
hookTypes of changes
Checklist: