Skip to content

Commit

Permalink
fix(plugin-meetings): resolved guest issue forbidden error (#3861)
Browse files Browse the repository at this point in the history
  • Loading branch information
Parimala032 authored Oct 4, 2024
1 parent 824d365 commit 5015271
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
1 change: 0 additions & 1 deletion docs/samples/browser-plugin-meetings/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ function unregister() {
});
}


async function getGuestAccessToken() {

await axios({
Expand Down
15 changes: 11 additions & 4 deletions packages/@webex/plugin-meetings/src/meetings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,18 @@ export default class Meetings extends WebexPlugin {
* @memberof Meetings
*/
fetchUserPreferredWebexSite() {
return this.request.getMeetingPreferences().then((res) => {
if (res) {
this.preferredWebexSite = MeetingsUtil.parseDefaultSiteFromMeetingPreferences(res);
// @ts-ignore
return this.webex.people._getMe().then((me) => {
const isGuestUser = me.type === 'appuser';
if (!isGuestUser) {
return this.request.getMeetingPreferences().then((res) => {
if (res) {
this.preferredWebexSite = MeetingsUtil.parseDefaultSiteFromMeetingPreferences(res);
}
});
}

return Promise.resolve();
});
}

Expand All @@ -774,7 +782,6 @@ export default class Meetings extends WebexPlugin {
* @public
* @memberof Meetings
*/

getPersonalMeetingRoom() {
return this.personalMeetingRoom;
}
Expand Down
16 changes: 16 additions & 0 deletions packages/@webex/plugin-meetings/test/unit/spec/meetings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ describe('plugin-meetings', () => {

Object.assign(webex, {
logger,
people: {
_getMe: sinon.stub().resolves({
type: 'validuser',
}),
}
});

Object.assign(webex.meetings, {
Expand Down Expand Up @@ -1276,6 +1281,17 @@ describe('plugin-meetings', () => {
assert.equal(webex.meetings.preferredWebexSite, 'go.webex.com');
});

it('should not call request.getMeetingPreferences if user is a guest', async () => {
Object.assign(webex.people,{
_getMe: sinon.stub().returns(Promise.resolve({type: 'appuser'})),
})

await webex.meetings.fetchUserPreferredWebexSite();

assert.equal(webex.meetings.preferredWebexSite, '');
assert.notCalled(webex.internal.services.getMeetingPreferences);
});

it('should not fail if UserPreferred info is not fetched ', async () => {
Object.assign(webex.internal, {
services: {
Expand Down

0 comments on commit 5015271

Please sign in to comment.