mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-10-29 02:44:12 +00:00
Return scoped carriers and speech creds in /SP GET call (#96)
* return scoped carriers and speech creds in /SP GET call * apply review comments Co-authored-by: eglehelms <e.helms@cognigy.com>
This commit is contained in:
1 parent
274377960e
commit
80ee1d06d7
2 files changed
+12
-3
No files matched your search
@@ -151,10 +151,14 @@ router.get('/', async(req, res) => {
|
||||
if (!account_sid) service_provider_sid = parseServiceProviderSid(req);
|
||||
const logger = req.app.locals.logger;
|
||||
try {
|
||||
const creds = account_sid ?
|
||||
let creds = account_sid ?
|
||||
await SpeechCredential.retrieveAll(account_sid) :
|
||||
await SpeechCredential.retrieveAllForSP(service_provider_sid);
|
||||
|
||||
if (req.user.hasScope('account')) {
|
||||
creds = creds.filter((c) => c.account_sid === req.user.account_sid || !c.account_sid);
|
||||
}
|
||||
|
||||
res.status(200).json(creds.map((c) => {
|
||||
const {credential, ...obj} = c;
|
||||
if ('google' === obj.vendor) {
|
||||
|
||||
Reference in new issue
Block a user