From a8ce5ef41c7432c4b4625e8225f679181ca204a2 Mon Sep 17 00:00:00 2001 From: Leif Ullman Date: Sat, 7 Mar 2015 13:42:11 -0700 Subject: [PATCH] Add modelFilter hook --- server/data_form.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/data_form.js b/server/data_form.js index ee95a4e0..adc9f725 100644 --- a/server/data_form.js +++ b/server/data_form.js @@ -359,7 +359,9 @@ DataForm.prototype.models = function () { return function (req, res) { // TODO: Make this less wasteful - we only need to send the resourceNames of the resources - res.send(that.resources); + // Check for optional modelFilter and call it with the request and current list. Otherwise just return the list. + res.send(that.options.modelFilter ? that.options.modelFilter.call(null, req, that.resources) : that.resources); + }; };