From 5ddf9f292c50deae3d66dff1bb0ea0721ece6cd2 Mon Sep 17 00:00:00 2001 From: Eric Dobbertin Date: Thu, 23 Apr 2015 09:56:33 -0500 Subject: [PATCH] pass userId to changeSelector --- README.md | 6 +++--- server/tabular.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d0fb51e..15a9100 100644 --- a/README.md +++ b/README.md @@ -183,14 +183,14 @@ TabularTables.People = new Tabular.Table({ ``` -## Modifying the selector +## Modifying the Selector -If your table requires the selector to be modified before it's published, you can modify it with the `changeSelector` method. This can be useful for modifying what will be returned in a search. +If your table requires the selector to be modified before it's published, you can modify it with the `changeSelector` method. This can be useful for modifying what will be returned in a search. It's called only on the server. ```js TabularTables.Posts = new Tabular.Table({ // other properties... - changeSelector: function(selector) { + changeSelector: function(selector, userId) { // modify it here ... return selector; } diff --git a/server/tabular.js b/server/tabular.js index 74049ee..65d822e 100644 --- a/server/tabular.js +++ b/server/tabular.js @@ -85,7 +85,7 @@ Meteor.publish("tabular_getInfo", function(tableName, selector, sort, skip, limi // Allow the user to modify the selector before we use it if (typeof table.changeSelector === 'function') { - selector = table.changeSelector(selector); + selector = table.changeSelector(selector, self.userId); } // Apply the server side selector specified in the tabular