From 0b27df09d6411b89c1694a779bb006cc13c36f15 Mon Sep 17 00:00:00 2001 From: sethvincent Date: Tue, 2 Jul 2019 08:50:02 -0700 Subject: [PATCH] filter clients in getClients by user id --- app/manage/client.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/manage/client.js b/app/manage/client.js index 5ec2aed7..d68db755 100644 --- a/app/manage/client.js +++ b/app/manage/client.js @@ -12,10 +12,12 @@ const manageId = serverRuntimeConfig.OSM_HYDRA_ID * @param {*} res */ async function getClients (req, res) { + const { session: { user_id } } = req let clients = await hydra.getClients() - // Remove first party app from list - let filteredClients = clients.filter(c => c.client_id !== manageId) + // Remove first party client from list & exclude clients the user does not own + let filteredClients = clients + .filter(c => c.client_id !== manageId && c.owner === user_id) return res.send({ clients: filteredClients }) }