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:
Hoan Luu Huu
2025-05-28 21:22:52 +07:00
committed by GitHub
parent bb5dba7c20
commit c51b7bab82

View File

@@ -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');