From e25a697b1ad152fa1fcae01b6872a19b6a31b9f0 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 4 Jan 2011 17:11:37 +0000 Subject: usermanager: Have methods not implemented in the active provider fall back to the null provider (later we can add support for chains of providers) --- core/usermanager.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3