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
commite25a697b1ad152fa1fcae01b6872a19b6a31b9f0 (patch)
treecae351aa2966164274e0d453b20389264ced3302 /core
parentd83b39cc4c9da3b21a1d2135eb7bd51e6f2dc242 (diff)
downloadprosody-e25a697b1ad152fa1fcae01b6872a19b6a31b9f0.tar.gz
prosody-e25a697b1ad152fa1fcae01b6872a19b6a31b9f0.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);