diff --git a/i18n/en-US.properties b/i18n/en-US.properties index 7e265bf90c..69f5119a54 100644 --- a/i18n/en-US.properties +++ b/i18n/en-US.properties @@ -922,6 +922,8 @@ be.uploadsFileSizeLimitExceededErrorMessage = File size exceeds the folder owner be.uploadsFileSizeLimitExceededErrorMessageForUpgradeCta = This file exceeds your plan’s upload limit. Upgrade now to store larger files. # Upgrade message shown when file size exceeds the limit be.uploadsFileSizeLimitExceededUpgradeMessageForUpgradeCta = Upgrade +# Error message shown when the user lacks permission to upload to the destination folder +be.uploadsInsufficientPermissionsErrorMessage = You don't have permission to upload to this folder # Error message shown when attempting to upload a file which name already exists be.uploadsItemNameInUseErrorMessage = A file with this name already exists. # Text shown when uploads are completed diff --git a/src/constants.js b/src/constants.js index b3a8385625..521947cbd4 100644 --- a/src/constants.js +++ b/src/constants.js @@ -273,6 +273,7 @@ export const ERROR_CODE_ITEM_NAME_TOO_LONG = 'item_name_too_long'; export const ERROR_CODE_ITEM_NAME_IN_USE = 'item_name_in_use'; export const ERROR_CODE_UPLOAD_FILE_LIMIT = 'upload_file_limit'; export const ERROR_CODE_UPLOAD_CHILD_FOLDER_FAILED = 'child_folder_failed_upload'; +export const ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS = 'access_denied_insufficient_permissions'; export const ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED = 'storage_limit_exceeded'; export const ERROR_CODE_UPLOAD_FILE_SIZE_LIMIT_EXCEEDED = 'file_size_limit_exceeded'; export const ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT = 'pending_app_folder_size_limit'; diff --git a/src/elements/common/messages.js b/src/elements/common/messages.js index d9773595e3..40ba226022 100644 --- a/src/elements/common/messages.js +++ b/src/elements/common/messages.js @@ -747,6 +747,11 @@ const messages = defineMessages({ description: 'Error message shown when account storage limit has been reached', defaultMessage: 'Account storage limit reached', }, + uploadsInsufficientPermissionsErrorMessage: { + id: 'be.uploadsInsufficientPermissionsErrorMessage', + description: 'Error message shown when the user lacks permission to upload to the destination folder', + defaultMessage: "You don't have permission to upload to this folder", + }, uploadsPendingFolderSizeLimitErrorMessage: { id: 'be.uploadsPendingFolderSizeLimitErrorMessage', description: 'Error message shown when pending app folder size exceeds the limit', diff --git a/src/elements/content-uploader/__tests__/CellRenderer.test.tsx b/src/elements/content-uploader/__tests__/CellRenderer.test.tsx index 735958f9d3..bc5e461271 100644 --- a/src/elements/content-uploader/__tests__/CellRenderer.test.tsx +++ b/src/elements/content-uploader/__tests__/CellRenderer.test.tsx @@ -17,6 +17,7 @@ import { ERROR_CODE_UPLOAD_FAILED_PACKAGE, ERROR_CODE_UPLOAD_FILE_SIZE_LIMIT_EXCEEDED, ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT, + ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS, ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED, } from '../../../constants'; @@ -99,6 +100,12 @@ describe('elements/content-uploader/CellRenderer', () => { expect(screen.getByText('Account storage limit reached')).toBeInTheDocument(); }); + test('renders distinct error message for insufficient permissions (403)', () => { + const rowData = { status: STATUS_ERROR, error: { code: ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS } }; + renderComponent(rowData); + expect(screen.getByText("You don't have permission to upload to this folder")).toBeInTheDocument(); + }); + test('renders error message for pending app folder size limit', () => { const rowData = { status: STATUS_ERROR, error: { code: ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT } }; renderComponent(rowData); diff --git a/src/elements/content-uploader/progressCellRenderer.tsx b/src/elements/content-uploader/progressCellRenderer.tsx index 1bcef8c34d..810c2619fa 100644 --- a/src/elements/content-uploader/progressCellRenderer.tsx +++ b/src/elements/content-uploader/progressCellRenderer.tsx @@ -9,6 +9,7 @@ import { ERROR_CODE_UPLOAD_FILE_SIZE_LIMIT_EXCEEDED, ERROR_CODE_ITEM_NAME_IN_USE, ERROR_CODE_ITEM_NAME_INVALID, + ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS, ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT, ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED, ERROR_CODE_UPLOAD_CHILD_FOLDER_FAILED, @@ -48,6 +49,8 @@ const getErrorMessage = ( ); case ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED: return ; + case ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS: + return ; case ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT: return ; case ERROR_CODE_UPLOAD_FAILED_PACKAGE: