Skip to content

Instantly share code, notes, and snippets.

@ashiqhassan95
Last active November 8, 2021 21:46
Show Gist options
  • Save ashiqhassan95/82c38cf527249a0e1b8604656348b932 to your computer and use it in GitHub Desktop.
Save ashiqhassan95/82c38cf527249a0e1b8604656348b932 to your computer and use it in GitHub Desktop.
Allow moderator to enter meeting without approval in lobby mode
Instruction
1. goto: cd /usr/share/jitsi-meet/prosody-plugins/
2. run: sudo patch -b </var/www/jitsi-meet/resources/prosody-plugins/muc_allow_moderator_enter_lobby.patch
3. You will see following:-
patching file mod_muc_lobby_rooms.lua
Hunk #1 succeeded at 1390 (offset 134 lines).
4. A backup file be saved in that same folder with named as mod_muc_lobby_rooms.lua.orig
==================================================================
--- mod_muc_lobby_rooms.lua 2021-09-16 11:43:45.425000000 +0530
+++ mod_muc_lobby_rooms.lua 2021-09-16 11:42:16.435872526 +0530
@@ -104,6 +104,25 @@
broadcast_json_msg(room, actor, notify_json);
end
+-- Check user is moderator or not.
+-- Return true if moderator else false
+function verify_occupant_is_moderator(origin)
+ local moderator = false;
+ local context_user = origin.jitsi_meet_context_user;
+ -- When the JWT payload having affiliation key with value owner/moderator/member
+ local jwt_affiliation = (context_user and context_user.affiliation) or '';
+ -- When the JWT payload having moderator key with value true or false
+ local jwt_moderator = (context_user and context_user.moderator) or '';
+
+ if jwt_affiliation == "owner" or jwt_affiliation == "moderator" then
+ moderator = true;
+ elseif jwt_moderator == true then
+ moderator = true;
+ end
+
+ return moderator;
+end
+
function filter_stanza(stanza)
if not stanza.attr or not stanza.attr.from or not main_muc_service then
return stanza;
@@ -333,6 +352,10 @@
whitelistJoin = true;
end
+ if not whitelistJoin then
+ whitelistJoin = verify_occupant_is_moderator(event.origin);
+ end
+
if whitelistJoin then
local affiliation = room:get_affiliation(invitee);
if not affiliation or affiliation == 0 then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment