Skip to content

Commit

Permalink
filter clients in getClients by user id
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvincent committed Jul 2, 2019
1 parent 9a23bad commit 0b27df0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/manage/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
Expand Down

0 comments on commit 0b27df0

Please sign in to comment.