people.js 524 B

1234567891011121314151617181920212223242526
  1. Meteor.publish('people', function(limit) {
  2. check(limit, Number);
  3. if (!Match.test(this.userId, String)) {
  4. return [];
  5. }
  6. const user = Users.findOne(this.userId);
  7. if (user && user.isAdmin) {
  8. return Users.find({}, {
  9. limit,
  10. sort: {createdAt: -1},
  11. fields: {
  12. 'username': 1,
  13. 'profile.fullname': 1,
  14. 'isAdmin': 1,
  15. 'emails': 1,
  16. 'createdAt': 1,
  17. 'loginDisabled': 1,
  18. 'authenticationMethod': 1,
  19. },
  20. });
  21. } else {
  22. return [];
  23. }
  24. });