# HG changeset patch # User Matthew Wild # Date 1294161097 0 # Node ID 73075b004e7772f6fc4eae19686a1fae06186f7e # Parent 2b86d7705f4eb92ba3125a0a6320f2b2406eb5c1 usermanager: Have methods not implemented in the active provider fall back to the null provider (later we can add support for chains of providers) diff -r 2b86d7705f4e -r 73075b004e77 core/usermanager.lua --- a/core/usermanager.lua Tue Jan 04 17:10:56 2011 +0000 +++ b/core/usermanager.lua Tue Jan 04 17:11:37 2011 +0000 @@ -31,6 +31,8 @@ }); 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 @@ 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);