Only list apps where a user has access to

This commit is contained in:
Johannes Zellner
2016-02-25 12:20:11 +01:00
parent 63013c7297
commit aa693e529b

View File

@@ -76,7 +76,10 @@ function getAppBySubdomain(req, res, next) {
}
function getApps(req, res, next) {
apps.getAll(function (error, allApps) {
assert.strictEqual(typeof req.user, 'object');
var func = req.user.admin ? apps.getAll : apps.getAllByUser.bind(null, req.user);
func(function (error, allApps) {
if (error) return next(new HttpError(500, error));
allApps = allApps.map(removeInternalAppFields);