56 function provider.get_sasl_handler() |
56 function provider.get_sasl_handler() |
57 local realm = module:get_option("sasl_realm") or module.host; |
57 local realm = module:get_option("sasl_realm") or module.host; |
58 return new_sasl(realm); |
58 return new_sasl(realm); |
59 end |
59 end |
60 |
60 |
61 function provider.is_admin(jid) |
|
62 local admins = config.get(host, "core", "admins"); |
|
63 if admins ~= config.get("*", "core", "admins") and type(admins) == "table" then |
|
64 jid = jid_bare(jid); |
|
65 for _,admin in ipairs(admins) do |
|
66 if admin == jid then return true; end |
|
67 end |
|
68 elseif admins then |
|
69 log("error", "Option 'admins' for host '%s' is not a table", host); |
|
70 end |
|
71 return is_admin(jid); -- Test whether it's a global admin instead |
|
72 end |
|
73 return provider; |
61 return provider; |
74 end |
62 end |
75 |
63 |
76 module:add_item("auth-provider", new_default_provider(module.host)); |
64 module:add_item("auth-provider", new_default_provider(module.host)); |
77 |
65 |