reactioncommerce/meteor-security

connection inside defined method

dr-dimitru opened this issue · 1 comments

Is there any chance to get this.connection.id inside deny function of defined method?
As we easily can do in Meteor's methods and publish
reference

Assuming you're using Security.can, you'd just have to pass it to your insert/update/remove function. Everything you pass in is forwarded. So this could be at the top of your method.

Security.can(this.userId).insert(doc, this.connection.id).for(myCollection).throw();

But if you mean for a client-initiated action that runs through allow/deny, then no, there isn't a way without changes to core Meteor packages.