users.js 878 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Meteor.publish('user-miniprofile', function(usernames) {
  2. check(usernames, Array);
  3. // eslint-disable-next-line no-console
  4. // console.log('usernames:', usernames);
  5. return Users.find(
  6. {
  7. $or: [
  8. { username: { $in: usernames } },
  9. { importUsernames: { $in: usernames } },
  10. ],
  11. },
  12. {
  13. fields: {
  14. ...Users.safeFields,
  15. importUsernames: 1,
  16. },
  17. },
  18. );
  19. });
  20. Meteor.publish('user-admin', function() {
  21. return Meteor.users.find(this.userId, {
  22. fields: {
  23. isAdmin: 1,
  24. teams: 1,
  25. orgs: 1,
  26. },
  27. });
  28. });
  29. Meteor.publish('user-authenticationMethod', function(match) {
  30. check(match, String);
  31. return Users.find(
  32. { $or: [{ _id: match }, { email: match }, { username: match }] },
  33. {
  34. fields: {
  35. authenticationMethod: 1,
  36. teams: 1,
  37. orgs: 1,
  38. },
  39. },
  40. );
  41. });