[solved] Where to publish all users?


#1

Hi Everyone,

Quick organizational question.

In which file & folder should I publish all my users so that I can access them in an admin page?

Should it be imports/api/users/server/publications.js ?


#2

Just write a secured publication

Meteor.publish('adminUsers', function() {
  // Check if the user is an admin (use your role system or something else)
  if (isAdmin(this.userId) {
    return Users.find();
  } else {
    return [];
  }
});

and yes, this can be in the file you mentioned.


#3

Awesome, thanks a lot!