add bundler stuff

This commit is contained in:
2026-07-08 16:59:00 -04:00
parent 2a5fbffaa2
commit ba3d87c27f
12 changed files with 425 additions and 70 deletions

View File

@@ -2,8 +2,8 @@ import { createEffect, createSignal, createMemo, JSXElement } from "solid-js";
import html from "solid-js/html";
import { useAuth } from "./AuthContext.ts";
import { getToken } from "./useAuthFetch.js";
import { hasPermission } from "./Permissions.js";
import { Loader } from "../ui/General.tsx";
import { hasPermission } from "./permissions.ts";
import { Loader } from "../kit/General.tsx";
interface ProtectedRouteProps {
permissions?: string[];

13
web/auth/permissions.ts Normal file
View File

@@ -0,0 +1,13 @@
// Generic permission check shared by the framework. The permission CONSTANTS
// (P_APP_*, P_ORG_*, ...) are application-specific and live app-side; only this
// membership test is generic. "*" (P_ALL) grants everything.
export const P_ALL = "*";
export function hasPermission(
permissions: string[] | null | undefined,
permission: string,
): boolean {
if (!permissions) return false;
if (permissions.includes(P_ALL)) return true;
return permissions.includes(permission);
}