diff mod_http_admin_api/mod_http_admin_api.lua @ 4396:de55e1475808

mod_http_admin_api: re-add information about invite creator It is now the JID of the user + a made up resource indicating that it was the admin API.
author Jonas Schäfer <jonas@wielicki.name>
date Tue, 26 Jan 2021 16:10:11 +0100
parents ae1d1e352504
children 5bc706c2db8f
line wrap: on
line diff
--- a/mod_http_admin_api/mod_http_admin_api.lua	Tue Jan 26 16:09:02 2021 +0100
+++ b/mod_http_admin_api/mod_http_admin_api.lua	Tue Jan 26 16:10:11 2021 +0100
@@ -120,6 +120,8 @@
 		options = {};
 	end
 
+	local source = event.session.username .. "@" .. module.host .. "/admin_api";
+
 	local invite;
 	if invite_type == "reset" then
 		if not options.username then
@@ -130,9 +132,12 @@
 		if not options.groups then
 			return 400;
 		end
-		invite = invites.create_group(options.groups, nil, options.ttl);
+		invite = invites.create_group(options.groups, {
+			source = source;
+		}, options.ttl);
 	elseif invite_type == "account" then
 		invite = invites.create_account(options.username, {
+			source = source;
 			groups = options.groups;
 		}, options.ttl);
 	else