get granular acls

Script windmill Verified

by admin ยท 8/13/2023

The script

Submitted by admin Typescript (fetch-only)
Verified 370 days ago
1
/**
2
 * get granular acls
3
 *
4
 */
5
export async function main(
6
  workspace: string,
7
  path: string,
8
  kind:
9
    | "script"
10
    | "group_"
11
    | "resource"
12
    | "schedule"
13
    | "variable"
14
    | "flow"
15
    | "folder"
16
    | "app"
17
    | "raw_app"
18
) {
19
  const url = new URL(
20
    `${BASE_URL}/api/w/${workspace}/acls/get/${kind}/${path}`
21
  );
22

23
  const response = await fetch(url, {
24
    method: "GET",
25
    headers: {
26
      Authorization: "Bearer " + WM_TOKEN,
27
    },
28
    body: undefined,
29
  });
30
  if (!response.ok) {
31
    const text = await response.text();
32
    throw new Error(`${response.status} ${text}`);
33
  }
34
  return await response.json();
35
}
36