Closed traugdor closed 4 years ago
Hi,
The documentation for alanning:roles states: "The currently logged-in user's roles field is automatically published to the client."
This is probably the reason why only the currently logged-in user's roles are available. Have you tried publishing all the user accounts server side (including the roles field)?
@stijndepestel is right. You'll need to publish the 'users' collection server side first, then subscribe to it client side, and then you can query for all user's roles.
Additionally, i would limit the publish function to users with an 'Admin' (or your equivalent) role.
If you need some guidance on doing this, there is a great set of tutorials on Youtube by Scott Tolinski for LevelUpTuts for Meteor Roles and Accounts. The Roles part doing what you want is covered in episodes 6, 7, and 8 of that series as I recall.
I think this was answered.
I'm trying to list the roles for all users for a user management page. So far every attempt to access and print all roles for all users has yielded bad results.
Expected: Array of roles for any user submitted by _id.
Actual output: undefined for every other user except the one that is logged in.
Is there another way to access the roles for every user in the system? Or will I have to
Any help here would be appreciated.