people.js 687 B

1234567891011121314151617181920212223242526272829303132
  1. import { ReactiveCache } from '/imports/reactiveCache';
  2. Meteor.publish('people', function(query, limit) {
  3. check(query, Match.OneOf(Object, null));
  4. check(limit, Number);
  5. let ret = [];
  6. const user = ReactiveCache.getCurrentUser();
  7. if (user && user.isAdmin) {
  8. ret = ReactiveCache.getUsers(query, {
  9. limit,
  10. sort: { createdAt: -1 },
  11. fields: {
  12. username: 1,
  13. 'profile.fullname': 1,
  14. 'profile.initials': 1,
  15. isAdmin: 1,
  16. emails: 1,
  17. createdAt: 1,
  18. loginDisabled: 1,
  19. authenticationMethod: 1,
  20. importUsernames: 1,
  21. orgs: 1,
  22. teams: 1,
  23. },
  24. },
  25. true);
  26. }
  27. return ret;
  28. });