93 }; |
93 }; |
94 return new_sasl(realm, getpass_authentication_profile); |
94 return new_sasl(realm, getpass_authentication_profile); |
95 end |
95 end |
96 |
96 |
97 function provider.is_admin(jid) |
97 function provider.is_admin(jid) |
98 local admins = config.get(host, "core", "admins"); |
98 local admins = module:get_option_array("admins"); |
99 if admins ~= config.get("*", "core", "admins") and type(admins) == "table" then |
99 if admins ~= config.get("*", "core", "admins") and type(admins) == "table" then |
100 jid = jid_bare(jid); |
100 jid = jid_bare(jid); |
101 for _,admin in ipairs(admins) do |
101 for _,admin in ipairs(admins) do |
102 if admin == jid then return true; end |
102 if admin == jid then return true; end |
103 end |
103 end |
104 elseif admins then |
|
105 log("error", "Option 'admins' for host '%s' is not a table", host); |
|
106 end |
104 end |
107 return is_admin(jid); -- Test whether it's a global admin instead |
|
108 end |
105 end |
109 return provider; |
106 return provider; |
110 end |
107 end |
111 |
108 |
112 module:add_item("auth-provider", new_default_provider(module.host)); |
109 module:add_item("auth-provider", new_default_provider(module.host)); |