Parcourir la source

Allow both regex and normal check for the room name

j8
Andrei Bora il y a 3 ans
Parent
révision
27481f0270
1 fichiers modifiés avec 13 ajouts et 5 suppressions
  1. 13
    5
      resources/prosody-plugins/token/util.lib.lua

+ 13
- 5
resources/prosody-plugins/token/util.lib.lua Voir le fichier

304
             -- Binds any features details to the session
304
             -- Binds any features details to the session
305
             session.jitsi_meet_context_features = claims["context"]["features"];
305
             session.jitsi_meet_context_features = claims["context"]["features"];
306
           end
306
           end
307
+          if claims["context"]["room"] ~= nil then
308
+            session.jitsi_meet_context_room = claims["context"]["room"]
309
+          end
307
         end
310
         end
308
         return true;
311
         return true;
309
     else
312
     else
370
             room_to_check = room_node;
373
             room_to_check = room_node;
371
         end
374
         end
372
     else
375
     else
373
-        -- no wildcard, so check room against authorized room regex from the token
374
-        if target_room ~= nil then
375
-            -- room with subdomain
376
-            room_to_check = target_room:match(auth_room);
376
+        -- no wildcard, so check room against authorized room from the token
377
+        if session.jitsi_meet_context_room and (session.jitsi_meet_context_room["regex"] == true or session.jitsi_meet_context_room["regex"] == "true") then
378
+            if target_room ~= nil then
379
+                -- room with subdomain
380
+                room_to_check = target_room:match(auth_room);
381
+            else
382
+                room_to_check = room_node:match(auth_room);
383
+            end
377
         else
384
         else
378
-            room_to_check = room_node:match(auth_room);
385
+            -- not a regex
386
+            room_to_check = auth_room;
379
         end
387
         end
380
         module:log("debug", "room to check: %s", room_to_check)
388
         module:log("debug", "room to check: %s", room_to_check)
381
         if not room_to_check then
389
         if not room_to_check then

Chargement…
Annuler
Enregistrer