changeset 5887:2aa66e928aa0

mod_http_admin_api: Allow specifying roles for invitations
author Matthew Wild <mwild1@gmail.com>
date Tue, 16 Apr 2024 14:15:16 +0100
parents 2c85397d7241
children 432efc39572f
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	Tue Apr 16 13:03:39 2024 +0100
+++ b/mod_http_admin_api/mod_http_admin_api.lua	Tue Apr 16 14:15:16 2024 +0100
@@ -153,11 +153,13 @@
 		end
 		invite = invites.create_group(options.groups, {
 			source = source;
+			roles = options.roles;
 		}, options.ttl);
 	elseif invite_type == "account" then
 		invite = invites.create_account(options.username, {
 			source = source;
 			groups = options.groups;
+			roles = options.roles;
 		}, options.ttl);
 	else
 		return 400;
--- a/mod_http_admin_api/openapi.yaml	Tue Apr 16 13:03:39 2024 +0100
+++ b/mod_http_admin_api/openapi.yaml	Tue Apr 16 14:15:16 2024 +0100
@@ -586,6 +586,13 @@
           items:
             type: string
             description: "Group ID"
+        roles:
+          type: array
+          nullable: true
+          description: "List of roles the new account should have (primary role first)"
+          items:
+            type: string
+            description: "Role name"
     NewGroupInvite:
       type: object
       properties:
@@ -601,6 +608,13 @@
           description: "IDs of existing group to add the new accounts to"
         group_options:
           $ref: '#/components/schemas/NewGroup'
+        roles:
+          type: array
+          nullable: true
+          description: "List of roles the new accounts should have (primary role first)"
+          items:
+            type: string
+            description: "Role name"
     NewResetInvite:
       type: object
       properties: