23 end |
23 end |
24 |
24 |
25 function provider.get_password(username) |
25 function provider.get_password(username) |
26 return nil, "Password not available."; |
26 return nil, "Password not available."; |
27 end |
27 end |
28 |
28 |
29 function provider.set_password(username, password) |
29 function provider.set_password(username, password) |
30 return nil, "Password based auth not supported."; |
30 return nil, "Password based auth not supported."; |
31 end |
31 end |
32 |
32 |
33 function provider.user_exists(username) |
33 function provider.user_exists(username) |
46 end |
46 end |
47 }; |
47 }; |
48 return new_sasl(realm, anonymous_authentication_profile); |
48 return new_sasl(realm, anonymous_authentication_profile); |
49 end |
49 end |
50 |
50 |
51 function provider.is_admin(jid) |
|
52 local admins = config.get(host, "core", "admins"); |
|
53 if admins ~= config.get("*", "core", "admins") and type(admins) == "table" then |
|
54 jid = jid_bare(jid); |
|
55 for _,admin in ipairs(admins) do |
|
56 if admin == jid then return true; end |
|
57 end |
|
58 elseif admins then |
|
59 log("error", "Option 'admins' for host '%s' is not a table", host); |
|
60 end |
|
61 return is_admin(jid); -- Test whether it's a global admin instead |
|
62 end |
|
63 return provider; |
51 return provider; |
64 end |
52 end |
65 |
53 |
66 local function dm_callback(username, host, datastore, data) |
54 local function dm_callback(username, host, datastore, data) |
67 if host == module.host then |
55 if host == module.host then |