Skip to content

Commit

Permalink
Merge branch 'main' into issues/477
Browse files Browse the repository at this point in the history
  • Loading branch information
wernerdv authored Aug 12, 2024
2 parents 1c60998 + 273e64c commit 0f2913b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package io.kafbat.ui.controller;

import static io.kafbat.ui.model.rbac.permission.TopicAction.ANALYSIS_RUN;
import static io.kafbat.ui.model.rbac.permission.TopicAction.ANALYSIS_VIEW;
import static io.kafbat.ui.model.rbac.permission.TopicAction.CREATE;
import static io.kafbat.ui.model.rbac.permission.TopicAction.DELETE;
import static io.kafbat.ui.model.rbac.permission.TopicAction.EDIT;
import static io.kafbat.ui.model.rbac.permission.TopicAction.MESSAGES_READ;
import static io.kafbat.ui.model.rbac.permission.TopicAction.VIEW;
import static java.util.stream.Collectors.toList;

Expand Down Expand Up @@ -272,7 +273,7 @@ public Mono<ResponseEntity<Void>> analyzeTopic(String clusterName, String topicN

var context = AccessContext.builder()
.cluster(clusterName)
.topicActions(topicName, MESSAGES_READ)
.topicActions(topicName, ANALYSIS_RUN)
.operationName("analyzeTopic")
.build();

Expand All @@ -288,7 +289,7 @@ public Mono<ResponseEntity<Void>> cancelTopicAnalysis(String clusterName, String
ServerWebExchange exchange) {
var context = AccessContext.builder()
.cluster(clusterName)
.topicActions(topicName, MESSAGES_READ)
.topicActions(topicName, ANALYSIS_RUN)
.operationName("cancelTopicAnalysis")
.build();

Expand All @@ -306,7 +307,7 @@ public Mono<ResponseEntity<TopicAnalysisDTO>> getTopicAnalysis(String clusterNam

var context = AccessContext.builder()
.cluster(clusterName)
.topicActions(topicName, MESSAGES_READ)
.topicActions(topicName, ANALYSIS_VIEW)
.operationName("getTopicAnalysis")
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public enum TopicAction implements PermissibleAction {
MESSAGES_READ(VIEW),
MESSAGES_PRODUCE(VIEW),
MESSAGES_DELETE(VIEW, EDIT),
ANALYSIS_VIEW(VIEW),
ANALYSIS_RUN(VIEW, ANALYSIS_VIEW),

;

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Topics/Topic/Statistics/Metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const Metrics: React.FC = () => {
buttonSize="M"
permission={{
resource: ResourceType.TOPIC,
action: Action.MESSAGES_READ,
action: Action.ANALYSIS_RUN,
value: params.topicName,
}}
>
Expand Down Expand Up @@ -110,7 +110,7 @@ const Metrics: React.FC = () => {
buttonSize="S"
permission={{
resource: ResourceType.TOPIC,
action: Action.MESSAGES_READ,
action: Action.ANALYSIS_RUN,
value: params.topicName,
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Statistics: React.FC = () => {
buttonSize="M"
permission={{
resource: ResourceType.TOPIC,
action: Action.MESSAGES_READ,
action: Action.ANALYSIS_RUN,
value: params.topicName,
}}
>
Expand Down
9 changes: 7 additions & 2 deletions frontend/src/components/Topics/Topic/Topic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,17 @@ const Topic: React.FC = () => {
>
Settings
</NavLink>
<NavLink
<ActionNavLink
to={clusterTopicStatisticsRelativePath}
className={({ isActive }) => (isActive ? 'is-active' : '')}
permission={{
resource: ResourceType.TOPIC,
action: Action.ANALYSIS_VIEW,
value: topicName,
}}
>
Statistics
</NavLink>
</ActionNavLink>
</Navbar>
<Suspense fallback={<PageLoader />}>
<Routes>
Expand Down

0 comments on commit 0f2913b

Please sign in to comment.