2
0

users.js 909 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. authenticationMethod: 1,
  27. },
  28. });
  29. });
  30. Meteor.publish('user-authenticationMethod', function(match) {
  31. check(match, String);
  32. return Users.find(
  33. { $or: [{ _id: match }, { email: match }, { username: match }] },
  34. {
  35. fields: {
  36. authenticationMethod: 1,
  37. teams: 1,
  38. orgs: 1,
  39. },
  40. },
  41. );
  42. });