From 762a630659aaa6691889d49a9ce33259c779fd6f Mon Sep 17 00:00:00 2001 From: csawatzky Date: Fri, 13 Feb 2026 12:51:26 -0600 Subject: [PATCH] some permission changes the team permission in the global state was coming back empty, so am now retrieving the team permissions for file uploads in grain transacitons, also adjusted the bin visualizer to disable the slider and inventory button when they do not have write permissions so they cant even open the transaction window, this should help prevent a case in the possible future where we allow bin transactions to have uploadable files from having a bin shared to them and uploading a file but not being able to create the transaction that it would be linked to thus causing the file to be uploaded to digital ocean, but not connected in our backend to anything --- src/bin/BinVisualizerV2.tsx | 7 +++++-- src/common/FileUploads/FileSelector.tsx | 11 ++++++----- src/common/FileUploads/FileUploader.tsx | 5 ++++- src/grain/GrainTransaction.tsx | 23 ++++++++++++++++++++--- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/bin/BinVisualizerV2.tsx b/src/bin/BinVisualizerV2.tsx index d91f698..9997927 100644 --- a/src/bin/BinVisualizerV2.tsx +++ b/src/bin/BinVisualizerV2.tsx @@ -1434,6 +1434,7 @@ export default function BinVisualizer(props: Props) { const controls = () => { if (bin.settings.inventory?.empty === true) return null; + const canEdit = permissions ? permissions.includes(pond.Permission.PERMISSION_WRITE) : false; return ( { setGrainUpdate(true); }} style={{ margin: "auto", - backgroundColor: "gold", + backgroundColor: canEdit ? "gold" : "grey", color: "black", height: "100%", width: isMobile ? 35 : 40 @@ -1468,6 +1470,7 @@ export default function BinVisualizer(props: Props) { alignContent="flex-end"> {fillPercentage !== null && ( { @@ -53,8 +54,8 @@ const useStyles = makeStyles((theme: Theme) => { }); export default function FileSelector(props: Props) { - const { uploadEnd, uploadStart, uniqueID, toAttach, keys, types } = props; - const [{ userTeamPermissions }] = useGlobalState(); + const { uploadEnd, uploadStart, uniqueID, toAttach, keys, types, hasFilePermission } = props; + // const [{ userTeamPermissions }] = useGlobalState(); const [fileList, setFileList] = useState(); const classes = useStyles(); const fileAPI = useFileControllerAPI(); @@ -142,7 +143,7 @@ export default function FileSelector(props: Props) { disabled={ uploading || (!uploadFailed && fileID !== "") || - !userTeamPermissions.includes(pond.Permission.PERMISSION_FILE_MANAGEMENT) + !hasFilePermission } multiple={false} name={uniqueID || "fileInput"} @@ -163,7 +164,7 @@ export default function FileSelector(props: Props) {