From 55eb63a36794ee8381a8ad515da9472140c6c1bd Mon Sep 17 00:00:00 2001 From: Christopher Poile Date: Thu, 3 Jul 2025 08:47:09 -0400 Subject: [PATCH] [MM-64735] Add defensive fallback for userHasReadPermissionOnSomeResources (#33072) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add defensive fallback for userHasReadPermissionOnSomeResources When called with a string instead of an object, the function now falls back to checking a single resource permission instead of failing. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * Revert "Add defensive fallback for userHasReadPermissionOnSomeResources" This reverts commit f9c32bc3e2598467e7c8a520319ac5ae49135cbf. * simpler fix -- remove string as a possible parameter --------- Co-authored-by: Claude --- .../src/components/admin_console/admin_definition_helpers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/channels/src/components/admin_console/admin_definition_helpers.tsx b/webapp/channels/src/components/admin_console/admin_definition_helpers.tsx index 41026bd4d6..2e76426e7e 100644 --- a/webapp/channels/src/components/admin_console/admin_definition_helpers.tsx +++ b/webapp/channels/src/components/admin_console/admin_definition_helpers.tsx @@ -60,7 +60,7 @@ export const it = { return cloud?.subscription?.is_free_trial === 'true'; }, userHasReadPermissionOnResource: (key: string) => (config: Partial, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess) => (consoleAccess?.read as any)?.[key], - userHasReadPermissionOnSomeResources: (key: string | { [key: string]: string }) => (config: Partial, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess) => Object.values(key).some((resource) => (consoleAccess?.read as any)?.[resource]), + userHasReadPermissionOnSomeResources: (key: { [key: string]: string }) => (config: Partial, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess) => Object.values(key).some((resource) => (consoleAccess?.read as any)?.[resource]), userHasWritePermissionOnResource: (key: string) => (config: Partial, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess) => (consoleAccess?.write as any)?.[key], isSystemAdmin: (config: Partial, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess, cloud?: CloudState, isSystemAdmin?: boolean) => Boolean(isSystemAdmin), };