This commit is contained in:
Kalle
2026-08-07 19:00:40 +03:00
parent 1e4eedd65a
commit 3765ebf90e
3 changed files with 5 additions and 4 deletions

View File

@@ -67,7 +67,7 @@ export const Config = {
/** Whether to show the LUTI navigation item. */
showLutiNavItem: values.VITE_SHOW_LUTI_NAV_ITEM,
fuseEnabled: values.VITE_FUSE_ENABLED,
/** Whether the scanner is available to everyone. While false only the admin can use the scanner page and its ingest endpoint. */
/** Whether the scanner is available to everyone. While false only the admin and devs can use the scanner page and its ingest endpoint. */
scannerEnabled: values.VITE_SCANNER_ENABLED,
/** Google Form URL for league registration, if configured. */
leagueGoogleFormUrl: values.VITE_LEAGUE_GOOGLE_FORM_URL,

View File

@@ -3,7 +3,7 @@ import type { ActionFunction } from "react-router";
import { Config } from "~/config";
import { requireUser } from "~/features/auth/core/user.server";
import type { ScannerMatch } from "~/features/scanner/core/scanner-match";
import { isAdmin } from "~/modules/permissions/utils";
import { isAdmin, isDev } from "~/modules/permissions/utils";
import { dateToDatabaseTimestamp } from "~/utils/dates";
import { logger } from "~/utils/logger";
import { forbidden, parseBody } from "~/utils/remix.server";
@@ -18,7 +18,7 @@ import {
export const action: ActionFunction = async ({ request }) => {
const user = requireUser();
if (!Config.scannerEnabled && !isAdmin(user)) {
if (!Config.scannerEnabled && !isAdmin(user) && !isDev(user)) {
forbidden();
}

View File

@@ -35,8 +35,9 @@ const ScannerApp = lazy(() =>
export default function ScannerPage() {
const isHydrated = useHydrated();
const isAdmin = useHasRole("ADMIN");
const isDev = useHasRole("DEV");
if (!Config.scannerEnabled && !isAdmin) {
if (!Config.scannerEnabled && !isAdmin && !isDev) {
return <Redirect to="/" />;
}