Comparison

core/usermanager.lua @ 5377:898454038524

core.*: Complete removal of all traces of the "core" section and section-related code.
author Kim Alvefur <zash@zash.se>
date Sat, 23 Mar 2013 02:33:15 +0100
parent 5157:0e1686f334b8
child 5776:bd0ff8ae98a8
comparison
equal deleted inserted replaced
5376:ba9be0be4bbb 5377:898454038524
40 local host_session = hosts[host]; 40 local host_session = hosts[host];
41 if host_session.type ~= "local" then return; end 41 if host_session.type ~= "local" then return; end
42 42
43 host_session.events.add_handler("item-added/auth-provider", function (event) 43 host_session.events.add_handler("item-added/auth-provider", function (event)
44 local provider = event.item; 44 local provider = event.item;
45 local auth_provider = config.get(host, "core", "authentication") or default_provider; 45 local auth_provider = config.get(host, "authentication") or default_provider;
46 if config.get(host, "core", "anonymous_login") then 46 if config.get(host, "anonymous_login") then
47 log("error", "Deprecated config option 'anonymous_login'. Use authentication = 'anonymous' instead."); 47 log("error", "Deprecated config option 'anonymous_login'. Use authentication = 'anonymous' instead.");
48 auth_provider = "anonymous"; 48 auth_provider = "anonymous";
49 end -- COMPAT 0.7 49 end -- COMPAT 0.7
50 if provider.name == auth_provider then 50 if provider.name == auth_provider then
51 host_session.users = setmetatable(provider, provider_mt); 51 host_session.users = setmetatable(provider, provider_mt);
59 if host_session.users == provider then 59 if host_session.users == provider then
60 host_session.users = new_null_provider(); 60 host_session.users = new_null_provider();
61 end 61 end
62 end); 62 end);
63 host_session.users = new_null_provider(); -- Start with the default usermanager provider 63 host_session.users = new_null_provider(); -- Start with the default usermanager provider
64 local auth_provider = config.get(host, "core", "authentication") or default_provider; 64 local auth_provider = config.get(host, "authentication") or default_provider;
65 if config.get(host, "core", "anonymous_login") then auth_provider = "anonymous"; end -- COMPAT 0.7 65 if config.get(host, "anonymous_login") then auth_provider = "anonymous"; end -- COMPAT 0.7
66 if auth_provider ~= "null" then 66 if auth_provider ~= "null" then
67 modulemanager.load(host, "auth_"..auth_provider); 67 modulemanager.load(host, "auth_"..auth_provider);
68 end 68 end
69 end; 69 end;
70 prosody.events.add_handler("host-activated", initialize_host, 100); 70 prosody.events.add_handler("host-activated", initialize_host, 100);
114 114
115 local is_admin; 115 local is_admin;
116 jid = jid_bare(jid); 116 jid = jid_bare(jid);
117 host = host or "*"; 117 host = host or "*";
118 118
119 local host_admins = config.get(host, "core", "admins"); 119 local host_admins = config.get(host, "admins");
120 local global_admins = config.get("*", "core", "admins"); 120 local global_admins = config.get("*", "admins");
121 121
122 if host_admins and host_admins ~= global_admins then 122 if host_admins and host_admins ~= global_admins then
123 if type(host_admins) == "table" then 123 if type(host_admins) == "table" then
124 for _,admin in ipairs(host_admins) do 124 for _,admin in ipairs(host_admins) do
125 if jid_prep(admin) == jid then 125 if jid_prep(admin) == jid then