Closed chrux closed 5 years ago
Hi @chrux, the roles data hasn't loaded on the client when the check is performed. The roles package will automatically subscribe to get the roles data for the current user but in this case you should have your page template or React view wait on the data before making auth decisions. The publication you need to wait on is named '_roles'.
With Blaze, you can template.subscribe('_roles')
in onCreated and then use the template.subscriptionsReady()
reactive function to check. See here for more:
http://blazejs.org/api/templates.html#Blaze-TemplateInstance-subscribe
Thanks will take a look on that
Hey, I am using alanning:roles@1.2.15, for some reason when I entered directly to the page where I validate if a roles is assigned to a user, the user's role attr is not defined/does not exist, any info about what I am doing wrong? It works if I got to other page where I do not have the role validation and after that navigate, but it does not work if I put the url directly or refresh.
Best