feature/user-api-calls (#80)

* initial changes for jwt auth

* return permissions as an array of string

* basic GET, POST, DELETE user api calls

* add permission checks

* hide hashed_password

* cleanup

* add check if admin user is active

* return account and serviceProvider sid un user object

* add more values to user PUT

* logout user after self delete, fix scope assignment

* add admin scope user tests

* fix test case and align jwt and api key data model in req.user

* fixes for ibm speech

* add limits license_count and voice_call_minutes

* update limits enum again

* rebase to main

* allow predefined carriers and speech credentials for Account user

* reverse the hasAccountPermissions changes

* SpeechCredentials permissions

* fix /Users/me api non-saas jambonz

Co-authored-by: Dave Horton <daveh@beachdognet.com>
Co-authored-by: eglehelms <e.helms@cognigy.com>
This commit is contained in:
EgleH
2022-12-10 09:12:05 -05:00
committed by GitHub
co-authored by Dave Horton eglehelms
parent fadbe116c2
commit dd2176bf89
14 changed files with 759 additions and 133 deletions
+2 -2
View File
@@ -119,9 +119,9 @@ router.post('/', async(req, res) => {
const account_sid = req.user.account_sid || req.body.account_sid;
let service_provider_sid;
if (!account_sid) {
if (!req.user.hasServiceProviderAuth) {
if (!req.user.hasServiceProviderAuth && !req.user.hasAdminAuth) {
logger.error('POST /SpeechCredentials invalid credentials');
return res.send(403);
return res.sendStatus(403);
}
service_provider_sid = parseServiceProviderSid(req);
}