Software / code / prosody
Comparison
core/usermanager.lua @ 4050:f380c998353b
usermanager: Assume authentication="anonymous" when anonymous_login=true.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Mon, 27 Dec 2010 20:46:01 +0500 |
| parent | 3887:9aa109f8b960 |
| child | 3991:2b86d7705f4e |
comparison
equal
deleted
inserted
replaced
| 4049:fe6f4a255fd8 | 4050:f380c998353b |
|---|---|
| 34 if host_session.type ~= "local" then return; end | 34 if host_session.type ~= "local" then return; end |
| 35 | 35 |
| 36 host_session.events.add_handler("item-added/auth-provider", function (event) | 36 host_session.events.add_handler("item-added/auth-provider", function (event) |
| 37 local provider = event.item; | 37 local provider = event.item; |
| 38 local auth_provider = config.get(host, "core", "authentication") or default_provider; | 38 local auth_provider = config.get(host, "core", "authentication") or default_provider; |
| 39 if config.get(host, "core", "anonymous_login") then auth_provider = "anonymous"; end -- COMPAT 0.7 | |
| 39 if provider.name == auth_provider then | 40 if provider.name == auth_provider then |
| 40 host_session.users = provider; | 41 host_session.users = provider; |
| 41 end | 42 end |
| 42 if host_session.users ~= nil and host_session.users.name ~= nil then | 43 if host_session.users ~= nil and host_session.users.name ~= nil then |
| 43 log("debug", "host '%s' now set to use user provider '%s'", host, host_session.users.name); | 44 log("debug", "host '%s' now set to use user provider '%s'", host, host_session.users.name); |
| 49 host_session.users = new_null_provider(); | 50 host_session.users = new_null_provider(); |
| 50 end | 51 end |
| 51 end); | 52 end); |
| 52 host_session.users = new_null_provider(); -- Start with the default usermanager provider | 53 host_session.users = new_null_provider(); -- Start with the default usermanager provider |
| 53 local auth_provider = config.get(host, "core", "authentication") or default_provider; | 54 local auth_provider = config.get(host, "core", "authentication") or default_provider; |
| 55 if config.get(host, "core", "anonymous_login") then auth_provider = "anonymous"; end -- COMPAT 0.7 | |
| 54 if auth_provider ~= "null" then | 56 if auth_provider ~= "null" then |
| 55 modulemanager.load(host, "auth_"..auth_provider); | 57 modulemanager.load(host, "auth_"..auth_provider); |
| 56 end | 58 end |
| 57 end; | 59 end; |
| 58 prosody.events.add_handler("host-activated", initialize_host, 100); | 60 prosody.events.add_handler("host-activated", initialize_host, 100); |