From b177628d3c336437b7098935b2e1040dc254e46a Mon Sep 17 00:00:00 2001
From: Matthew Wild <mwild1@gmail.com>
Date: Mon, 27 Jan 2020 22:09:19 +0000
Subject: usermanager: Load authz providers on components also

---
 core/usermanager.lua | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/core/usermanager.lua b/core/usermanager.lua
index ec98d12f..47d157bf 100644
--- a/core/usermanager.lua
+++ b/core/usermanager.lua
@@ -55,6 +55,12 @@ local provider_mt = { __index = new_null_provider() };
 
 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 @@ local function initialize_host(host)
 		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);
 
-- 
cgit v1.2.3