From ccf4d957f80f0fd2daa1dbe26836ce972ddf2d58 Mon Sep 17 00:00:00 2001 From: Arul Date: Sun, 28 Mar 2021 01:32:46 +0800 Subject: [PATCH] Adds a way to retrieve features allowed for a specific user --- Parse-Dashboard/app.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Parse-Dashboard/app.js b/Parse-Dashboard/app.js index b3ce1b4191..33af04cbea 100644 --- a/Parse-Dashboard/app.js +++ b/Parse-Dashboard/app.js @@ -124,7 +124,6 @@ module.exports = function(config, options) { const isSame = app.appId === appUserHasAccess.appId; if (isSame && appUserHasAccess.readOnly) { app.masterKey = app.readOnlyMasterKey; - console.log(req.user); } return isSame; }) @@ -149,6 +148,15 @@ module.exports = function(config, options) { res.send({ success: false, error: 'Something went wrong.' }); }); + // Serve what features allowed for logged in user + app.get('/allowed-features.json', function (req, res) { + if (users && req.user && req.user.matchingUsername) { + const found = users.find(i => i.user === req.user.matchingUsername); + return res.json(found.features || {}); + } + return res.json({}); + }); + // Serve the app icons. Uses the optional `iconsFolder` parameter as // directory name, that was setup in the config file. // We are explicitly not using `__dirpath` here because one may be