Selaa lähdekoodia

FE: RBAC: Fix missing permissions for topic recreation (#3457)

* fix missing permission for recreate topic

Co-authored-by: jay-choe <jay0764@naver.com>
Co-authored-by: p-eye <peyed3@gmail.com>

* fix unnecessary permission

* add disable attribute, ActionDropdownItem

* remove dropdownitem lib

* fix eslint by #3080

---------

Co-authored-by: jay-choe <jay0764@naver.com>
Co-authored-by: p-eye <peyed3@gmail.com>
a1tair6 2 vuotta sitten
vanhempi
commit
814035e254
1 muutettua tiedostoa jossa 9 lisäystä ja 7 poistoa
  1. 9 7
      kafka-ui-react-app/src/components/Topics/List/ActionsCell.tsx

+ 9 - 7
kafka-ui-react-app/src/components/Topics/List/ActionsCell.tsx

@@ -4,11 +4,7 @@ import { CellContext } from '@tanstack/react-table';
 import ClusterContext from 'components/contexts/ClusterContext';
 import { ClusterNameRoute } from 'lib/paths';
 import useAppParams from 'lib/hooks/useAppParams';
-import {
-  Dropdown,
-  DropdownItem,
-  DropdownItemHint,
-} from 'components/common/Dropdown';
+import { Dropdown, DropdownItemHint } from 'components/common/Dropdown';
 import {
   useDeleteTopic,
   useClearTopicMessages,
@@ -55,7 +51,8 @@ const ActionsCell: React.FC<CellContext<Topic, unknown>> = ({ row }) => {
           with DELETE policy
         </DropdownItemHint>
       </ActionDropdownItem>
-      <DropdownItem
+      <ActionDropdownItem
+        disabled={!isTopicDeletionAllowed}
         onClick={recreateTopic.mutateAsync}
         confirm={
           <>
@@ -63,9 +60,14 @@ const ActionsCell: React.FC<CellContext<Topic, unknown>> = ({ row }) => {
           </>
         }
         danger
+        permission={{
+          resource: ResourceType.TOPIC,
+          action: [Action.VIEW, Action.CREATE, Action.DELETE],
+          value: name,
+        }}
       >
         Recreate Topic
-      </DropdownItem>
+      </ActionDropdownItem>
       <ActionDropdownItem
         disabled={!isTopicDeletionAllowed}
         onClick={() => deleteTopic.mutateAsync(name)}