diff --git a/packages/allow-deny/allow-deny.js b/packages/allow-deny/allow-deny.js index 596bb801b3..20936bc3a2 100644 --- a/packages/allow-deny/allow-deny.js +++ b/packages/allow-deny/allow-deny.js @@ -187,9 +187,10 @@ CollectionPrototype._defineMutationMethods = function(options) { } const syncMethodName = method.replace('Async', ''); - // it forces to use async validated method as part of the method - const validatedMethodName = - '_validated' + method.charAt(0).toUpperCase() + syncMethodName.slice(1) + 'Async'; + const syncValidatedMethodName = '_validated' + method.charAt(0).toUpperCase() + syncMethodName.slice(1); + // it forces to use async validated behavior on the server + const validatedMethodName = Meteor.isServer ? syncValidatedMethodName + 'Async' : syncValidatedMethodName; + args.unshift(this.userId); isInsert(method) && args.push(generatedId); return self[validatedMethodName].apply(self, args);