users.js 812 B

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