User Permissions Modal

This commit is contained in:
Jamie Curnow
2025-09-08 22:01:00 +10:00
parent fa11945235
commit ca84e3a146
11 changed files with 325 additions and 16 deletions

View File

@@ -124,7 +124,7 @@ export async function post({ url, params, data, noAuth }: PostArgs, abortControl
interface PutArgs {
url: string;
params?: queryString.StringifiableRecord;
data?: Record<string, unknown>;
data?: Record<string, any>;
}
export async function put({ url, params, data }: PutArgs, abortController?: AbortController) {
const apiUrl = buildUrl({ url, params });

View File

@@ -38,6 +38,7 @@ export * from "./models";
export * from "./refreshToken";
export * from "./renewCertificate";
export * from "./responseTypes";
export * from "./setPermissions";
export * from "./testHttpCertificate";
export * from "./toggleDeadHost";
export * from "./toggleProxyHost";

View File

@@ -5,10 +5,10 @@ export interface AppVersion {
}
export interface UserPermissions {
id: number;
createdOn: string;
modifiedOn: string;
userId: number;
id?: number;
createdOn?: string;
modifiedOn?: string;
userId?: number;
visibility: string;
proxyHosts: string;
redirectionHosts: string;

View File

@@ -0,0 +1,17 @@
import * as api from "./base";
import type { UserPermissions } from "./models";
export async function setPermissions(
userId: number,
data: UserPermissions,
abortController?: AbortController,
): Promise<boolean> {
// Remove readonly fields
return await api.put(
{
url: `/users/${userId}/permissions`,
data,
},
abortController,
);
}