Skip to content

Commit

Permalink
fix: restrict access to debugging purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
ledouxm committed Nov 22, 2024
1 parent b880cc4 commit edd81d3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/frontend/src/features/upload/UploadImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { createModal } from "@codegouvfr/react-dsfr/Modal";
import { ImageCanvas, Line } from "./DrawingCanvas";
import { api } from "../../api";
import imageCompression from "browser-image-compression";
import { useUser } from "../../contexts/AuthContext";

const modal = createModal({
id: "edit-picture",
Expand Down Expand Up @@ -111,6 +112,14 @@ export const UploadImage = ({ reportId }: { reportId: string }) => {
return () => broadcastChannel.removeEventListener("message", listener);
}, []);

const user = useUser()!;

// TODO delete this line, this is a temporary test
const canUploadImage = [
"user-e0960bb7-355e-4194-a8a9-5f059512e282",
"user-607d5ff4-df93-4823-bd94-1626d595ec74",
].includes(user.id);

return (
<>
<styled.div
Expand Down Expand Up @@ -152,6 +161,7 @@ export const UploadImage = ({ reportId }: { reportId: string }) => {
<Button
type="button"
iconId="ri-add-line"
disabled={!canUploadImage}
priority="secondary"
nativeButtonProps={{
type: "button",
Expand Down

0 comments on commit edd81d3

Please sign in to comment.