SHARE
TWEET

Untitled

a guest Aug 18th, 2018 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Meteor.methods({
  2. "users.add": function(newUser) {
  3. let cResult = Accounts.createUser({
  4. username: newUser.username,
  5. email: newUser.email
  6. password: newUser.password,
  7. profile: {
  8. first_name: newUser.first_name,
  9. last_name: newUser.last_name,
  10. clinic: newUser.clinic
  11. }
  12. });
  13. for (var index in newUser.roles) {
  14. Roles.addUsersToRoles(cResult, newUser.roles[index].label);
  15. }
  16. return true;
  17. },
  18. "users.addRole": function(userId, newRole) {
  19. Roles.addUsersToRoles(userId, newRole);
  20. return true;
  21. }
  22. });
  23.    
  24. export default withTracker(() => {
  25. let usersSubscription = Meteor.subscribe("allUsers");
  26. let rolesSubscriptioin = Meteor.subscribe("allRoles");
  27. const eachReady = usersSubscription.ready() &&
  28.                   rolesSubscriptioin.ready();
  29. const loading = usersSubscription ? !eachReady : true;
  30. return {
  31. loading,
  32. users: Meteor.users.find().fetch(),
  33. roles: Meteor.roles.find().fetch()
  34. };
  35. })(Users);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top