Software / code / prosody-modules
Comparison
mod_muc_http_auth/mod_muc_http_auth.lua @ 4299:8006da2cf44c
For deployments that have https://hg.prosody.im/trunk/file/tip/plugins/muc/register.lib.lua#l7 and use https://modules.prosody.im/mod_muc_http_auth.html users can still register to a MUC even if they are not allowed to join. That means they would receive RAI or RMN, for instance.
| author | Seve Ferrer <seve@delape.net> |
|---|---|
| date | Tue, 15 Dec 2020 11:26:29 +0100 |
| parent | 4296:08138de4cb88 |
| child | 4301:bcb2b9adfcde |
comparison
equal
deleted
inserted
replaced
| 4298:020dd0a59f1f | 4299:8006da2cf44c |
|---|---|
| 7 | 7 |
| 8 local authorization_url = module:get_option("muc_http_auth_url", "") | 8 local authorization_url = module:get_option("muc_http_auth_url", "") |
| 9 local enabled_for = module:get_option_set("muc_http_auth_enabled_for", nil) | 9 local enabled_for = module:get_option_set("muc_http_auth_enabled_for", nil) |
| 10 local disabled_for = module:get_option_set("muc_http_auth_disabled_for", nil) | 10 local disabled_for = module:get_option_set("muc_http_auth_disabled_for", nil) |
| 11 local insecure = module:get_option("muc_http_auth_insecure", false) --For development purposes | 11 local insecure = module:get_option("muc_http_auth_insecure", false) --For development purposes |
| 12 local authorize_registration = module:get_option("muc_http_auth_authorize_registration", false) | |
| 12 | 13 |
| 13 local function must_be_authorized(room_node) | 14 local function must_be_authorized(room_node) |
| 14 -- If none of these is set, all rooms need authorization | 15 -- If none of these is set, all rooms need authorization |
| 15 if not enabled_for and not disabled_for then return true; end | 16 if not enabled_for and not disabled_for then return true; end |
| 16 | 17 |
| 74 | 75 |
| 75 module:log("debug", user_bare_jid .. " is authorized to join " .. room.jid); | 76 module:log("debug", user_bare_jid .. " is authorized to join " .. room.jid); |
| 76 return; | 77 return; |
| 77 end | 78 end |
| 78 | 79 |
| 80 if authorize_registration then | |
| 81 module:hook("muc-register-iq", handle_presence); | |
| 82 end | |
| 79 | 83 |
| 80 module:hook("muc-occupant-pre-join", handle_presence); | 84 module:hook("muc-occupant-pre-join", handle_presence); |