add bundler stuff
This commit is contained in:
@@ -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
13
web/auth/permissions.ts
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user