Changeset

3992:73075b004e77

usermanager: Have methods not implemented in the active provider fall back to the null provider (later we can add support for chains of providers)
author Matthew Wild <mwild1@gmail.com>
date Tue, 04 Jan 2011 17:11:37 +0000
parents 3991:2b86d7705f4e
children 3993:b71e5ecc694b
files core/usermanager.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);