usermanager: Load authz providers on components also
authorMatthew Wild <mwild1@gmail.com>
Mon, 27 Jan 2020 22:09:19 +0000
changeset 10638 c9e1cb7a38b8
parent 10637 d1cc6af0fb97
child 10639 675d9fbcbaed
usermanager: Load authz providers on components also
core/usermanager.lua
--- a/core/usermanager.lua	Mon Jan 27 21:54:59 2020 +0000
+++ b/core/usermanager.lua	Mon Jan 27 22:09:19 2020 +0000
@@ -55,6 +55,12 @@
 
 local function initialize_host(host)
 	local host_session = hosts[host];
+
+	local authz_provider_name = config.get(host, "authorization") or "internal";
+
+	local authz_mod = modulemanager.load(host, "authz_"..authz_provider_name);
+	host_session.authz = authz_mod or global_authz_provider;
+
 	if host_session.type ~= "local" then return; end
 
 	host_session.events.add_handler("item-added/auth-provider", function (event)
@@ -84,10 +90,6 @@
 		modulemanager.load(host, "auth_"..auth_provider);
 	end
 
-	local authz_provider_name = config.get(host, "authorization") or "internal";
-
-	local authz_mod = modulemanager.load(host, "authz_"..authz_provider_name);
-	host_session.authz = authz_mod or global_authz_provider;
 end;
 prosody.events.add_handler("host-activated", initialize_host, 100);