people.js 649 B

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