mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-11-08 20:43:46 +00:00
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:
19 files changed
+530
-126
No files matched your search
+6
-6
@@ -127,7 +127,7 @@ test('authentication tests', async(t) => {
|
||||
sip_realm: 'sip.foo.bar'
|
||||
}
|
||||
});
|
||||
t.ok(result.statusCode === 422 && result.body.msg === 'cannot update account from different service provider',
|
||||
t.ok(result.statusCode === 403 && result.body.msg === 'insufficient permissions',
|
||||
'service provider token B cannot be used to update account from service provider A');
|
||||
|
||||
/* cannot delete account from different service provider */
|
||||
@@ -137,7 +137,7 @@ test('authentication tests', async(t) => {
|
||||
simple: false,
|
||||
json: true,
|
||||
});
|
||||
t.ok(result.statusCode === 422 && result.body.msg === 'cannot delete account from different service provider',
|
||||
t.ok(result.statusCode === 403 && result.body.msg === 'insufficient permissions',
|
||||
'service provider token B cannot be used to delete account from service provider A');
|
||||
|
||||
/* service provider token A can update account A1 */
|
||||
@@ -179,7 +179,7 @@ test('authentication tests', async(t) => {
|
||||
}
|
||||
});
|
||||
//console.log(`result: ${JSON.stringify(result)}`);
|
||||
t.ok(result.statusCode === 422 && result.body.msg === 'insufficient permissions to create accounts',
|
||||
t.ok(result.statusCode === 403 && result.body.msg === 'insufficient permissions',
|
||||
'cannot create an account using an account-level token');
|
||||
|
||||
/* using account token we see one account */
|
||||
@@ -200,8 +200,7 @@ test('authentication tests', async(t) => {
|
||||
sip_realm: 'sip.foo.bar'
|
||||
}
|
||||
});
|
||||
//console.log(`result: ${JSON.stringify(result)}`);
|
||||
t.ok(result.statusCode === 422 && result.body.msg === 'insufficient privileges to update this account',
|
||||
t.ok(result.statusCode === 403 && result.body.msg === 'insufficient permissions',
|
||||
'cannot update account A2 using auth token for account A1');
|
||||
|
||||
/* can update an account using an appropriate account-level token */
|
||||
@@ -251,7 +250,8 @@ test('authentication tests', async(t) => {
|
||||
}
|
||||
}
|
||||
});
|
||||
t.ok(result.statusCode === 400 && result.body.msg === 'insufficient privileges to create an application under the specified account',
|
||||
//console.log(`result: ${JSON.stringify(result)}`);
|
||||
t.ok(result.statusCode === 403 && result.body.msg === 'insufficient privileges',
|
||||
'cannot create application for account A2 using service provider token B');
|
||||
|
||||
result = await request.post('/Applications', {
|
||||
|
||||
Reference in new issue
Block a user