aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-01-04 17:11:37 +0000
committerMatthew Wild <mwild1@gmail.com>2011-01-04 17:11:37 +0000
commitf31871eb2e61b2ecc0555b4265d24e4bcd9d8f49 (patch)
treeb79c4c2b0276a5885ac2547ac262d8aae3b7ceab /core
parent73752efbfdb1411bd6137cca65baeb35ed0eb08d (diff)
downloadprosody-f31871eb2e61b2ecc0555b4265d24e4bcd9d8f49.tar.gz
prosody-f31871eb2e61b2ecc0555b4265d24e4bcd9d8f49.zip
usermanager: Have methods not implemented in the active provider fall back to the null provider (later we can add support for chains of providers)
Diffstat (limited to 'core')
-rw-r--r--core/usermanager.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/usermanager.lua b/core/usermanager.lua
index 2b060cc0..d4a00244 100644
--- a/core/usermanager.lua
+++ b/core/usermanager.lua
@@ -31,6 +31,8 @@ function new_null_provider()
});
end
+local provider_mt = { __index = new_null_provider() };
+
function initialize_host(host)
local host_session = hosts[host];
if host_session.type ~= "local" then return; end
@@ -40,7 +42,7 @@ function initialize_host(host)
local auth_provider = config.get(host, "core", "authentication") or default_provider;
if config.get(host, "core", "anonymous_login") then auth_provider = "anonymous"; end -- COMPAT 0.7
if provider.name == auth_provider then
- host_session.users = provider;
+ host_session.users = setmetatable(provider, provider_mt);
end
if host_session.users ~= nil and host_session.users.name ~= nil then
log("debug", "host '%s' now set to use user provider '%s'", host, host_session.users.name);