Skip to content

Commit

Permalink
Adds a way to retrieve features allowed for a specific user
Browse files Browse the repository at this point in the history
  • Loading branch information
Arul- committed Mar 27, 2021
1 parent f6a2532 commit ccf4d95
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Parse-Dashboard/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
})
Expand All @@ -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
Expand Down

0 comments on commit ccf4d95

Please sign in to comment.