Skip to content

Commit 59f0320

Browse files
committed
FE: Fix permissions check for cluster edit (#3862)
(cherry picked from commit 71a7a1e)
1 parent aa633f4 commit 59f0320

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

kafka-ui-react-app/src/components/Dashboard/ClusterTableActionsCell.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const ClusterTableActionsCell: React.FC<Props> = ({ row }) => {
1111
const { name } = row.original;
1212
const { data } = useGetUserInfo();
1313

14-
const isApplicationConfig = useMemo(() => {
14+
const hasPermissions = useMemo(() => {
15+
if (!data?.rbacEnabled) return true;
1516
return !!data?.userInfo?.permissions.some(
1617
(permission) => permission.resource === ResourceType.APPLICATIONCONFIG
1718
);
@@ -22,7 +23,7 @@ const ClusterTableActionsCell: React.FC<Props> = ({ row }) => {
2223
buttonType="secondary"
2324
buttonSize="S"
2425
to={clusterConfigPath(name)}
25-
canDoAction={isApplicationConfig}
26+
canDoAction={hasPermissions}
2627
>
2728
Configure
2829
</ActionCanButton>

kafka-ui-react-app/src/components/Dashboard/Dashboard.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ const Dashboard: React.FC = () => {
5757
return initialColumns;
5858
}, []);
5959

60-
const isApplicationConfig = useMemo(() => {
60+
const hasPermissions = useMemo(() => {
61+
if (!data?.rbacEnabled) return true;
6162
return !!data?.userInfo?.permissions.some(
6263
(permission) => permission.resource === ResourceType.APPLICATIONCONFIG
6364
);
@@ -91,7 +92,7 @@ const Dashboard: React.FC = () => {
9192
buttonType="primary"
9293
buttonSize="M"
9394
to={clusterNewConfigPath}
94-
canDoAction={isApplicationConfig}
95+
canDoAction={hasPermissions}
9596
>
9697
Configure new cluster
9798
</ActionCanButton>

0 commit comments

Comments
 (0)