Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Voip endpoint permissions #25783

Merged
merged 2 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apps/meteor/app/api/server/v1/voip/rooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ const parseAndValidate = (property: string, date?: string): DateParam => {

API.v1.addRoute(
'voip/room',
{ authRequired: false, rateLimiterOptions: { numRequestsAllowed: 5, intervalTimeInMS: 60000 } },
{
authRequired: true,
rateLimiterOptions: { numRequestsAllowed: 5, intervalTimeInMS: 60000 },
permissionsRequired: ['inbound-voip-calls'],
},
{
async get() {
const defaultCheckParams = {
Expand Down Expand Up @@ -212,7 +216,7 @@ API.v1.addRoute(
*/
API.v1.addRoute(
'voip/room.close',
{ authRequired: true },
{ authRequired: true, permissionsRequired: ['inbound-voip-calls'] },
{
async post() {
check(this.bodyParams, {
Expand Down
2 changes: 2 additions & 0 deletions apps/meteor/tests/end-to-end/api/02-channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,13 @@ describe('[Channels]', function () {
before(() => updateSetting('VoIP_Enabled', true));
const createVoipRoom = async () => {
const testUser = await createUser({ roles: ['user', 'livechat-agent'] });
const testUserCredentials = await login(testUser.username, password);
const visitor = await createVisitor();
const roomResponse = await createRoom({
token: visitor.token,
type: 'v',
agentId: testUser._id,
credentials: testUserCredentials,
});
return roomResponse.body.room;
};
Expand Down