Meteor JS - enable / disable rules

In the example "parties" of the application, there is a set of allow / deny rules for the meeting of the Parties. The rule for is insertas follows:

Parties.allow({
  insert: function (userId, party) {
    return false; // no cowboy inserts -- use createParty method
  },...

At the same time, the createParty method implements Party.insert ({....}), which is somehow not affected by the rules applicable to the meeting of the Parties.

.....
return Parties.insert({
      owner: this.userId,
      x: options.x,
      y: options.y,
      title: options.title,
      description: options.description,
      public: !! options.public,
      invited: [],
      rsvps: []
    });
.....

Can someone explain why the createParty method is not affected by the rules?

Thank.

+5
source share
1 answer

createPartyis located in Meteor.methods, which runs on the server, as well as on the client side, calling Meteor.call('createParties')from the client. On the client, it will not insert any data, but the method running on the server inserts the side.

Meteors allow deny , , , .

+10

All Articles