Skip to content

Commit

Permalink
Merge pull request #11 from bipmeet/feature/8922_webinar_ldap
Browse files Browse the repository at this point in the history
Feature/8922 webinar ldap
  • Loading branch information
gizembg authored Jul 22, 2024
2 parents 708fba4 + 915f38a commit 8e86423
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 5 deletions.
5 changes: 3 additions & 2 deletions JitsiConference.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,10 @@ JitsiConference.prototype._init = function(options = {}) {
* @param replaceParticipant {boolean} whether the current join replaces
* an existing participant with same jwt from the meeting.
*/
JitsiConference.prototype.join = function(password, replaceParticipant = false, captchaId, captchaValue) {
JitsiConference.prototype.join = function(password, replaceParticipant = false, captchaId, captchaValue, email, ldapPassword) {
if (this.room) {
this.room.join(password, replaceParticipant, captchaId, captchaValue).then(() => this._maybeSetSITimeout());
this.room.join(password, replaceParticipant, captchaId, captchaValue, email, ldapPassword)
.then(() => this._maybeSetSITimeout());
}
};

Expand Down
3 changes: 3 additions & 0 deletions JitsiConferenceErrors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as exported from "./JitsiConferenceErrors";

describe( "/JitsiConferenceErrors members", () => {
const {
WEBINAR_AUTHENTICATION_REQUIRED,
AUTHENTICATION_REQUIRED,
CHAT_ERROR,
SETTINGS_ERROR,
Expand Down Expand Up @@ -31,6 +32,7 @@ describe( "/JitsiConferenceErrors members", () => {
} = exported;

it( "known members", () => {
expect( WEBINAR_AUTHENTICATION_REQUIRED ).toBe( 'conference.webinarAuthenticationRequired' );
expect( AUTHENTICATION_REQUIRED ).toBe( 'conference.authenticationRequired' );
expect( CHAT_ERROR ).toBe( 'conference.chatError' );
expect( SETTINGS_ERROR ).toBe( 'conference.settingsError' );
Expand All @@ -56,6 +58,7 @@ describe( "/JitsiConferenceErrors members", () => {

expect( JitsiConferenceErrors ).toBeDefined();

expect( JitsiConferenceErrors.WEBINAR_AUTHENTICATION_REQUIRED ).toBe( 'conference.webinarAuthenticationRequired' );
expect( JitsiConferenceErrors.AUTHENTICATION_REQUIRED ).toBe( 'conference.authenticationRequired' );
expect( JitsiConferenceErrors.CHAT_ERROR ).toBe( 'conference.chatError' );
expect( JitsiConferenceErrors.SETTINGS_ERROR ).toBe( 'conference.settingsError' );
Expand Down
6 changes: 6 additions & 0 deletions JitsiConferenceErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
*/

export enum JitsiConferenceErrors {
/**
* Indicates that client must be authenticated to create the conference.
*/
WEBINAR_AUTHENTICATION_REQUIRED = 'conference.webinarAuthenticationRequired',

/**
* Indicates that client must be authenticated to create the conference.
*/
Expand Down Expand Up @@ -122,6 +127,7 @@ export enum JitsiConferenceErrors {
};

// exported for backward compatibility
export const WEBINAR_AUTHENTICATION_REQUIRED = JitsiConferenceErrors.WEBINAR_AUTHENTICATION_REQUIRED;
export const AUTHENTICATION_REQUIRED = JitsiConferenceErrors.AUTHENTICATION_REQUIRED;
export const CHAT_ERROR = JitsiConferenceErrors.CHAT_ERROR;
export const SETTINGS_ERROR = JitsiConferenceErrors.SETTINGS_ERROR;
Expand Down
4 changes: 4 additions & 0 deletions JitsiConferenceEventManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.PASSWORD_REQUIRED);

this.chatRoomForwarder.forward(XMPPEvents.WEBINAR_AUTHENTICATION_REQUIRED,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.WEBINAR_AUTHENTICATION_REQUIRED);

this.chatRoomForwarder.forward(XMPPEvents.AUTHENTICATION_REQUIRED,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.AUTHENTICATION_REQUIRED);
Expand Down
9 changes: 8 additions & 1 deletion JitsiConnectionErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@ export enum JitsiConnectionErrors {
* Indicates that the connection was dropped, because of too many 5xx HTTP
* errors on BOSH requests.
*/
SERVER_ERROR = 'connection.serverError'
SERVER_ERROR = 'connection.serverError',

/**
* Indicates that the connection was dropped, because of too many 5xx HTTP
* errors on BOSH requests.
*/
WEBINAR_AUTHENTICATION_REQUIRED = 'connection.webinarAuthenticationRequired'
};

// exported for backward compatibility
export const CONNECTION_DROPPED_ERROR = JitsiConnectionErrors.CONNECTION_DROPPED_ERROR;
export const OTHER_ERROR = JitsiConnectionErrors.OTHER_ERROR;
export const PASSWORD_REQUIRED = JitsiConnectionErrors.PASSWORD_REQUIRED;
export const WEBINAR_AUTHENTICATION_REQUIRED = JitsiConnectionErrors.WEBINAR_AUTHENTICATION_REQUIRED;
export const SERVER_ERROR = JitsiConnectionErrors.SERVER_ERROR;
45 changes: 43 additions & 2 deletions modules/xmpp/ChatRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,12 @@ export default class ChatRoom extends Listenable {
* @returns {Promise} - resolved when join completes. At the time of this
* writing it's never rejected.
*/
join(password, replaceParticipant, captchaId, captchaValue) {
join(password, replaceParticipant, captchaId, captchaValue, email, ldapPassword) {
this.password = password;
this.captchaId = captchaId;
this.captchaValue = captchaValue;
this.email = email;
this.ldapPassword = ldapPassword;
this.replaceParticipant = replaceParticipant;

return new Promise(resolve => {
Expand Down Expand Up @@ -273,6 +275,12 @@ export default class ChatRoom extends Listenable {
pres.c('captchaId').t(this.captchaId).up();
pres.c('captchaValue').t(this.captchaValue).up();
}
if (this.email) {
pres.c('email').t(this.email).up();
}
if (this.ldapPassword) {
pres.c('user_password').t(this.ldapPassword).up();
}
if (this.options.billingId) {
pres.c('billingid').t(this.options.billingId).up();
}
Expand Down Expand Up @@ -376,10 +384,12 @@ export default class ChatRoom extends Listenable {

const autoRecordingWithoutAction = $(result).find('>query>feature[var="auto_recording_without_action"]').length === 1;

const visitorChat = $(result).find('>query>feature[var="visitor_chat"]').length === 1;

this.eventEmitter.emit(XMPPEvents.MUC_ROOM_VISIBILITY_CHANGED,
specialRoom, roomOwner, externalScheduled, coHost, autoRecording,
disableMuteOthers, whiteListEnabled, disableParticipantChat,
liveStreamEnable, autoRecordingWithoutAction);
liveStreamEnable, autoRecordingWithoutAction, visitorChat);

const everybodyHasMicAccess
= $(result).find('>query>x[type="result"]>field[var="muc#roomconfig_bip_allow_microphone"]>value')
Expand Down Expand Up @@ -1350,6 +1360,37 @@ export default class ChatRoom extends Listenable {
'>error[type="modify"]>displayname-required[xmlns="http://jitsi.org/jitmeet"]')).length) {
logger.warn('display name required ', pres);
this.eventEmitter.emit(XMPPEvents.DISPLAY_NAME_REQUIRED, errorDescriptionNode[0].attributes.lobby?.value);
} else if ($(pres)
.find('>error[type="modify"]'
+ '>email-required['
+ 'xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length
|| $(pres)
.find('>error[type="modify"]'
+ '>ldap-auth-required['
+ 'xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length
|| $(pres)
.find('>error[type="modify"]'
+ '>ldap-auth-error['
+ 'xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {

const isLdapForce = $(pres).find('>error[type="modify"]>ldap-auth-required');
const isLdapError = $(pres).find('>error[type="modify"]>ldap-auth-error');

const msgNode = $(pres).find('>error[type="modify"]>text');
let msg = '';

if (msgNode.length) {
msg = msgNode.text();
}

if (isLdapForce.length || isLdapError.length) {
this.eventEmitter.emit(XMPPEvents.WEBINAR_AUTHENTICATION_REQUIRED, {
type: 'ldap-auth-required',
errmsg: msg
});
} else {
this.eventEmitter.emit(XMPPEvents.WEBINAR_AUTHENTICATION_REQUIRED, { type: 'email-required' });
}
} else {
const msgNode = $(pres).find('>error[type="cancel"]>text');
let msg;
Expand Down
1 change: 1 addition & 0 deletions service/xmpp/XMPPEvents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe( "/service/xmpp/XMPPEvents members", () => {
expect( XMPPEvents.ADD_ICE_CANDIDATE_FAILED ).toBe( 'xmpp.add_ice_candidate_failed' );
expect( XMPPEvents.AUDIO_MUTED_BY_FOCUS ).toBe( 'xmpp.audio_muted_by_focus' );
expect( XMPPEvents.VIDEO_MUTED_BY_FOCUS ).toBe( 'xmpp.video_muted_by_focus' );
expect( XMPPEvents.WEBINAR_AUTHENTICATION_REQUIRED ).toBe( 'xmpp.webinar_authentication_required' );
expect( XMPPEvents.AUTHENTICATION_REQUIRED ).toBe( 'xmpp.authentication_required' );
expect( XMPPEvents.BRIDGE_DOWN ).toBe( 'xmpp.bridge_down' );
expect( XMPPEvents.CALL_ACCEPTED ).toBe( 'xmpp.callaccepted.jingle' );
Expand Down
1 change: 1 addition & 0 deletions service/xmpp/XMPPEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export enum XMPPEvents {
// camera.
VIDEO_MUTED_BY_FOCUS = 'xmpp.video_muted_by_focus',
AUTHENTICATION_REQUIRED = 'xmpp.authentication_required',
WEBINAR_AUTHENTICATION_REQUIRED = 'xmpp.webinar_authentication_required',
BRIDGE_DOWN = 'xmpp.bridge_down',

/**
Expand Down
1 change: 1 addition & 0 deletions types/hand-crafted/JitsiConferenceErrors.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum JitsiConferenceErrors {
WEBINAR_AUTHENTICATION_REQUIRED = 'conference.webinarAuthenticationRequired',
AUTHENTICATION_REQUIRED = 'conference.authenticationRequired',
CHAT_ERROR = 'conference.chatError',
CONFERENCE_DESTROYED = 'conference.destroyed',
Expand Down
1 change: 1 addition & 0 deletions types/hand-crafted/service/xmpp/XMPPEvents.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
ADD_ICE_CANDIDATE_FAILED = 'xmpp.add_ice_candidate_failed',
AUDIO_MUTED_BY_FOCUS = 'xmpp.audio_muted_by_focus',
VIDEO_MUTED_BY_FOCUS = 'xmpp.video_muted_by_focus',
WEBINAR_AUTHENTICATION_REQUIRED = 'xmpp.webinar_authentication_required',
AUTHENTICATION_REQUIRED = 'xmpp.authentication_required',
BRIDGE_DOWN = 'xmpp.bridge_down',
CALL_ACCEPTED = 'xmpp.callaccepted.jingle',
Expand Down

0 comments on commit 8e86423

Please sign in to comment.