Comparison

core/usermanager.lua @ 3065:0b8bd6f6a9c7

Merge 0.7->trunk
author Matthew Wild <mwild1@gmail.com>
date Thu, 20 May 2010 11:44:41 +0100
parent 3053:8bd3857a75ee
parent 3064:596303990c7c
child 3116:90a98a6b52ac
comparison
equal deleted inserted replaced
3060:6c1cfb4cea3c 3065:0b8bd6f6a9c7
13 local ipairs = ipairs; 13 local ipairs = ipairs;
14 local hashes = require "util.hashes"; 14 local hashes = require "util.hashes";
15 local jid_bare = require "util.jid".bare; 15 local jid_bare = require "util.jid".bare;
16 local config = require "core.configmanager"; 16 local config = require "core.configmanager";
17 local hosts = hosts; 17 local hosts = hosts;
18
19 local require_provisioning = config.get("*", "core", "cyrus_require_provisioning") or false;
18 20
19 local prosody = _G.prosody; 21 local prosody = _G.prosody;
20 22
21 module "usermanager" 23 module "usermanager"
22 24
69 end 71 end
70 return nil, "Account not available."; 72 return nil, "Account not available.";
71 end 73 end
72 74
73 function provider:user_exists(username) 75 function provider:user_exists(username)
74 if is_cyrus(host) then return true; end 76 if not(require_provisioning) and is_cyrus(host) then return true; end
75 return datamanager.load(username, host, "accounts") ~= nil; -- FIXME also check for empty credentials 77 return datamanager.load(username, host, "accounts") ~= nil; -- FIXME also check for empty credentials
76 end 78 end
77 79
78 function provider:create_user(username, password) 80 function provider:create_user(username, password)
79 if is_cyrus(host) then return nil, "Account creation/modification not available with Cyrus SASL."; end 81 if not(require_provisioning) and is_cyrus(host) then return nil, "Account creation/modification not available with Cyrus SASL."; end
80 return datamanager.store(username, host, "accounts", {password = password}); 82 return datamanager.store(username, host, "accounts", {password = password});
81 end 83 end
82 84
83 function provider:get_supported_methods() 85 function provider:get_supported_methods()
84 return {["PLAIN"] = true, ["DIGEST-MD5"] = true}; -- TODO this should be taken from the config 86 return {["PLAIN"] = true, ["DIGEST-MD5"] = true}; -- TODO this should be taken from the config