diff --git a/app/controllers/app.js b/app/controllers/app.js index 7cc47c3f..6dafd9a0 100755 --- a/app/controllers/app.js +++ b/app/controllers/app.js @@ -53,6 +53,15 @@ function queryMayWrite(sql) { return mayWrite; } +// Return database username from user_id +// NOTE: a "null" user_id is a request to use the public user +function userid_to_dbuser(user_id) { + if ( _.isString(user_id) ) + return _.template(global.settings.db_user, {user_id: user_id}); + return "publicuser" // FIXME: make configurable +}; + + // request handlers function handleQuery(req, res) {