Limit access to resources according to user scoped Account or SP (#140)

* limit access to resources according to user scope

* fix error change

* speech credentials validation

* fix speech credentials validation

* fix the issues that didnt allow tests to pass

* speech credential validation

* retrieve speech cred list

* fixt speech credential test valodation

* check scope of smpp-gateways

* check scope of smpp-gateways

* testing time

* /signin for hosted system needs to return scope in jwt

* fix user delete route and adjust tests

* get refactor

---------

Co-authored-by: eglehelms <e.helms@cognigy.com>
Co-authored-by: Dave Horton <daveh@beachdognet.com>
Co-authored-by: Guilherme Rauen <g.rauen@cognigy.com>
This commit is contained in:
authored and GitHub committed 2023-04-05 14:20:51 -04:00
1 parent 8f93b69af0
commit b2dce18c7a
19 files changed
+530 -126

No files matched your search

+14 -11
View File
@@ -243,17 +243,20 @@ test('webapp tests', async(t) => {
t.ok(result.statusCode === 200 &&
result.body.phonenumbers.length === 1 && result.body.applications.length === 1, 'retrieves test number and application');
/* update user name */
result = await request.put(`/Users/foobar`, {
resolveWithFullResponse: true,
json: true,
simple: false,
auth: authUser,
body: {
name: 'Jane Doe'
}
});
t.ok(result.statusCode === 403, 'rejects attempt to update different user');
/* try to update user name passing an invalid uuid */
try {
await request.put(`/Users/foobar`, {
resolveWithFullResponse: true,
json: true,
simple: false,
auth: authUser,
body: {
name: 'Jane Doe'
}
});
} catch (error) {
t.ok(error.statusCode === 400, 'returns 400 bad request if user sid param is not a valid uuid');
}
/* update user name */
result = await request.put(`/Users/${user_sid}`, {