Changeset

5919:095030677ae6

mod_http_admin_api: Support storing free-form text note with invitations
author Matthew Wild <mwild1@gmail.com>
date Mon, 29 Apr 2024 17:49:19 +0100
parents 5918:423163b65bb1
children 5921:896e7c7bf87f
files mod_http_admin_api/mod_http_admin_api.lua mod_http_admin_api/openapi.yaml
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_admin_api/mod_http_admin_api.lua	Mon Apr 29 02:00:34 2024 +0200
+++ b/mod_http_admin_api/mod_http_admin_api.lua	Mon Apr 29 17:49:19 2024 +0100
@@ -82,6 +82,7 @@
 	local groups = additional_data and additional_data.groups or nil;
 	local roles = additional_data and additional_data.roles or nil;
 	local source = additional_data and additional_data.source or nil;
+	local note = additional_data and additional_data.note or nil;
 	local reset = not not (additional_data and additional_data.allow_reset or nil);
 	return {
 		id = token_info.token;
@@ -97,6 +98,7 @@
 		roles = roles;
 		source = source;
 		reset = reset;
+		note = note;
 	};
 end
 
@@ -156,12 +158,14 @@
 		invite = invites.create_group(options.groups, {
 			source = source;
 			roles = options.roles;
+			note = options.note;
 		}, options.ttl);
 	elseif invite_type == "account" then
 		invite = invites.create_account(options.username, {
 			source = source;
 			groups = options.groups;
 			roles = options.roles;
+			note = options.note;
 		}, options.ttl);
 	else
 		return 400;
--- a/mod_http_admin_api/openapi.yaml	Mon Apr 29 02:00:34 2024 +0200
+++ b/mod_http_admin_api/openapi.yaml	Mon Apr 29 17:49:19 2024 +0100
@@ -545,6 +545,10 @@
           type: string
           description: HTTPS URL of invite page (use in preference to XMPP URI when available)
           nullable: true
+        note:
+          type: string
+          nullable: true
+          description: Free-form text note/annotation to help identify the invitation
         created_at:
           type: integer
           description: Unix timestamp of invite creation
@@ -599,6 +603,10 @@
           items:
             type: string
             description: "Role name"
+        note:
+          type: string
+          nullable: true
+          description: Free-form text note/annotation to help identify the invitation
     NewGroupInvite:
       type: object
       properties:
@@ -621,6 +629,10 @@
           items:
             type: string
             description: "Role name"
+        note:
+          type: string
+          nullable: true
+          description: Free-form text note/annotation to help identify the invitation
     NewResetInvite:
       type: object
       properties: