[MM-64735] Add defensive fallback for userHasReadPermissionOnSomeResources (#33072)

* 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 <noreply@anthropic.com>

* Revert "Add defensive fallback for userHasReadPermissionOnSomeResources"

This reverts commit f9c32bc3e2598467e7c8a520319ac5ae49135cbf.

* simpler fix -- remove string as a possible parameter

---------

Co-authored-by: Claude <noreply@anthropic.com>
Этот коммит содержится в:
Christopher Poile
2025-07-03 08:47:09 -04:00
коммит произвёл GitHub
родитель 5cd3a3f745
Коммит 55eb63a367

Просмотреть файл

@@ -60,7 +60,7 @@ export const it = {
return cloud?.subscription?.is_free_trial === 'true';
},
userHasReadPermissionOnResource: (key: string) => (config: Partial<AdminConfig>, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess) => (consoleAccess?.read as any)?.[key],
userHasReadPermissionOnSomeResources: (key: string | { [key: string]: string }) => (config: Partial<AdminConfig>, 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<AdminConfig>, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess) => Object.values(key).some((resource) => (consoleAccess?.read as any)?.[resource]),
userHasWritePermissionOnResource: (key: string) => (config: Partial<AdminConfig>, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess) => (consoleAccess?.write as any)?.[key],
isSystemAdmin: (config: Partial<AdminConfig>, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess, cloud?: CloudState, isSystemAdmin?: boolean) => Boolean(isSystemAdmin),
};