meteorterminalconsoleangular-meteormeteor-useraccounts

angular meteor How update user data in client/myComponent.js but not in the google console


The aim is to transfert for exemple 2€ from user1 to user2

model/myComponents.js

Meteor.users.allow({
  update: function (userId) {   
    //check if an user is connected
    if(userId == null){
      return false;
    }else{
      return true;
    }
  },
  remove: function () {
    return false;
  }
});

client/myComponents.js

...
this.chooseWinner = (subject,comment) => {
...
// this works
Meteor.users.update({_id: comment.user_id}, {$set:{credit : winCash}});
...

In the google chrome terminal, I can do this :

Meteor.userId();

I obtain something like : "HTjgBTBcBk4npQSBe"

After in the google chrome terminal, I ca do this :

Meteor.users.update({_id: "HTjgBTBcBk4npQSBe"}, {$set:{credit : 12.34}});

!!!! Then the credit of this user is modified !!!!!

How can I do to update in client/myComponent.js but not in the google console ???

Thank you


Solution

  • Thank you @Leaf,

    I didn't use anymore "allow" or "deny".

    It's safer with meteor method

    I used this doc : http://www.angular-meteor.com/tutorials/socially/angular1/meteor-methods

    Hope, this can help someone.