Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(metadata): Always check the features on modifications.

damencho124c2137e9a5
diff --git a/resources/prosody-plugins/mod_filter_iq_rayo.lua b/resources/prosody-plugins/mod_filter_iq_rayo.lua
index 4f2a3cb264..07af447fd7 100644
--- a/resources/prosody-plugins/mod_filter_iq_rayo.lua
+++ b/resources/prosody-plugins/mod_filter_iq_rayo.lua
@@ -257,7 +257,6 @@ module:hook('jitsi-metadata-allow-moderation', function (event)
-- if it is recording we want to allow setting in metadata if not moderator but features
-- are present
if session.jitsi_meet_context_features
- and occupant.role ~= 'moderator'
and is_feature_allowed('transcription', session.jitsi_meet_context_features)
and is_feature_allowed('recording', session.jitsi_meet_context_features) then
local res = {};
@@ -266,14 +265,10 @@ module:hook('jitsi-metadata-allow-moderation', function (event)
elseif not session.jitsi_meet_context_features and occupant.role == 'moderator' then
return data;
else
- return nil;
+ return false;
end
end
- if occupant.role == 'moderator' then
- return data;
- end
-
return nil;
end);
diff --git a/resources/prosody-plugins/mod_room_metadata_component.lua b/resources/prosody-plugins/mod_room_metadata_component.lua
index 89e32c0fc2..d221ca8914 100644
--- a/resources/prosody-plugins/mod_room_metadata_component.lua
+++ b/resources/prosody-plugins/mod_room_metadata_component.lua
@@ -176,17 +176,21 @@ function on_message(event)
return false;
end
- if occupant.role ~= 'moderator' then
- -- will return a non nil filtered data to use, if it is nil, it is not allowed
- local res = module:context(main_virtual_host):fire_event('jitsi-metadata-allow-moderation',
- { room = room; actor = occupant; key = jsonData.key ; data = jsonData.data; session = session; });
+ -- will return a non nil filtered data to use, if it is nil, it is not allowed
+ local res = module:context(main_virtual_host):fire_event('jitsi-metadata-allow-moderation',
+ { room = room; actor = occupant; key = jsonData.key ; data = jsonData.data; session = session; });
- if not res then
- module:log('warn', 'Occupant %s is not moderator and not allowed this operation for %s', from, room.jid);
+ if res == false then
+ module:log('warn', 'Occupant %s features do not allow this operation(%s) for %s', from, jsonData.key, room.jid);
+ return false;
+ elseif res ~= nil then
+ jsonData.data = res;
+ else
+ if occupant.role ~= 'moderator' then
+ module:log('warn', 'Occupant %s is not moderator and not allowed this operation(%s) for %s',
+ from, jsonData.key, room.jid);
return false;
end
-
- jsonData.data = res;
end
local old_value = room.jitsiMetadata[jsonData.key];