Skip to content
Discussion options

You must be logged in to vote

Okay, I see, thanks for the reference. If you go this way, you can just use useSanctumUser composable to extract permissions via user.can property. I do not see any benefit of having usePermissions on the module level, especially since this functionality is not a part of Sanctum, but some external package which people might not use at all.

I would suggest implementing this helper composable as a part of your application, as you mentioned. However, keep in mind, that user identity is not refetched while you are navigating between pages, so if some permissions have been revoked or assigned, you have to refetch identity manually via refreshIdentity method available as a part of useSanctumAuth

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@manchenkoff
Comment options

Answer selected by projct1
Comment options

You must be logged in to vote
3 replies
@manchenkoff
Comment options

@projct1
Comment options

@manchenkoff
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants