diff --git a/kafka-ui-react-app/src/lib/permissions.ts b/kafka-ui-react-app/src/lib/permissions.ts index 8afd83ff59..e72ffecf95 100644 --- a/kafka-ui-react-app/src/lib/permissions.ts +++ b/kafka-ui-react-app/src/lib/permissions.ts @@ -47,6 +47,12 @@ interface IsPermittedConfig { rbacFlag: boolean; } +const valueMatches = (regexp: string | undefined, val: string | undefined) => { + if (!val) return false; + if (!regexp) return true; + return new RegExp(regexp).test(val); +}; + /** * @description it the logic behind depending on the roles whether a certain action * is permitted or not the philosophy is inspired from Headless UI libraries where @@ -94,15 +100,6 @@ export function isPermitted({ const resourcePermissions = clusterMap.get(resource); if (!resourcePermissions) return false; - const valueMatches = ( - regexp: string | undefined, - val: string | undefined - ) => { - if (!val) return false; - if (!regexp) return true; - return new RegExp(regexp).test(val); - }; - const actions = Array.isArray(action) ? action : [action]; return actions.every((a) => {