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(plugin-meetings): resolved guest issue forbidden error #3861

Merged
merged 3 commits into from
Oct 4, 2024
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
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() {
});
}


sreenara marked this conversation as resolved.
Show resolved Hide resolved
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
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
Loading