1 | |
2 |
|
3 | import * as wmill from "windmill-client" |
4 |
|
5 | |
6 | wmill.OpenAPI.interceptors.response.use(async (response) => { |
7 | if (!response.ok) { |
8 | throw new Error(`${response.status} ${await response.text()}`) |
9 | } |
10 | return response |
11 | }) |
12 |
|
13 | export type DynSelect_name = string |
14 |
|
15 | export async function name() { |
16 | const names = await wmill.GroupService.listGroupNames({ |
17 | workspace: wmill.getWorkspace(), |
18 | }) |
19 | return names.map((n) => ({ value: n, label: n })) |
20 | } |
21 |
|
22 | export type DynSelect_username = string |
23 |
|
24 | export async function username() { |
25 | const names = await wmill.UserService.listUsernames({ |
26 | workspace: wmill.getWorkspace(), |
27 | }) |
28 | return names.map((n) => ({ value: n, label: n })) |
29 | } |
30 |
|
31 | |
32 | * Remove User from Group |
33 | * Remove a user from a group. Requires a workspace admin or a group admin. |
34 | */ |
35 | export async function main(name: DynSelect_name, username: DynSelect_username) { |
36 | return await wmill.GroupService.removeUserToGroup({ |
37 | workspace: wmill.getWorkspace(), |
38 | name, |
39 | requestBody: { username }, |
40 | }) |
41 | } |
42 |
|