mod_auth_external/mod_auth_external.lua
changeset 1155 40f7a8d152eb
parent 1154 61f95bf51b35
child 1156 3c82984ffa51
equal deleted inserted replaced
1154:61f95bf51b35 1155:40f7a8d152eb
   102 		end,
   102 		end,
   103 	};
   103 	};
   104 	return new_sasl(host, testpass_authentication_profile);
   104 	return new_sasl(host, testpass_authentication_profile);
   105 end
   105 end
   106 
   106 
   107 function provider.is_admin(jid)
       
   108 	local admins = config.get(host, "core", "admins");
       
   109 	if admins ~= config.get("*", "core", "admins") then
       
   110 		if type(admins) == "table" then
       
   111 			jid = jid_bare(jid);
       
   112 			for _,admin in ipairs(admins) do
       
   113 				if admin == jid then return true; end
       
   114 			end
       
   115 		elseif admins then
       
   116 			log("error", "Option 'admins' for host '%s' is not a table", host);
       
   117 		end
       
   118 	end
       
   119 	return usermanager.is_admin(jid); -- Test whether it's a global admin instead
       
   120 end
       
   121 
       
   122 module:provides("auth", provider);
   107 module:provides("auth", provider);