Meteor-Community-Packages / meteor-roles

Authorization package for Meteor, compatible with built-in accounts packages
http://meteor-community-packages.github.io/meteor-roles/
MIT License
920 stars 164 forks source link

Document when `Roles.userIsInRole` is usable on the client #345

Open Prinzhorn opened 2 years ago

Prinzhorn commented 2 years ago

The code reveals that I need to wait for Roles.subscription.ready(), additionally I wait for Accounts.loginServicesConfigured() so that my user is ready as well. Roles.subscription.ready() should be documented in the Client section, which currently only talks about Blaze and some general security advice.

I'm not using Blaze so I can't comment on the isInRole helper and if it's safe to use it immediately or if everyone just gets lucky because the rendering usually loses the race against the subscription I/O.