mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2025-12-19 05:47:46 +00:00
admin can create call on behalf of account (#446)
* admin and service provider can create call on behalf of account * wip * admin and service provider can create call on behalf of account * wip * wip * wip
This commit is contained in:
@@ -382,7 +382,10 @@ async function validateCreateCall(logger, sid, req) {
|
||||
const {lookupAppBySid} = req.app.locals;
|
||||
const obj = req.body;
|
||||
|
||||
if (req.user.account_sid !== sid) throw new DbErrorBadRequest(`unauthorized createCall request for account ${sid}`);
|
||||
if (req.user.hasServiceProviderAuth ||
|
||||
req.user.hasAccountAuth && req.user.account_sid !== sid) {
|
||||
throw new DbErrorBadRequest(`unauthorized createCall request for account ${sid}`);
|
||||
}
|
||||
|
||||
obj.account_sid = sid;
|
||||
if (!obj.from) throw new DbErrorBadRequest('missing from parameter');
|
||||
|
||||
Reference in New Issue
Block a user