Skip to content

Commit

Permalink
RBAC: Fix connect deletion permissions, minor FE fixes (#107)
Browse files Browse the repository at this point in the history
Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
Co-authored-by: Zuev Kirill <Zuev.kirill95@yandex.ru>
Co-authored-by: ramadhan.rahmat <ramadhan.rahmat@bps.go.id>
Co-authored-by: Oldřich Jedlička <oldium.pro@gmail.com>
  • Loading branch information
4 people authored Feb 17, 2024
1 parent a8d111e commit e280c8e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions api/src/main/java/io/kafbat/ui/config/CustomWebFilter.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.kafbat.ui.config;

import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
Expand All @@ -10,13 +11,13 @@
public class CustomWebFilter implements WebFilter {

@Override
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
public @NotNull Mono<Void> filter(ServerWebExchange exchange, @NotNull WebFilterChain chain) {

final String basePath = exchange.getRequest().getPath().contextPath().value();

final String path = exchange.getRequest().getPath().pathWithinApplication().value();

if (path.startsWith("/ui") || path.equals("") || path.equals("/")) {
if (path.startsWith("/ui") || path.isEmpty() || path.equals("/")) {
return chain.filter(
exchange.mutate().request(
exchange.getRequest().mutate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public Mono<ResponseEntity<Void>> deleteConnector(String clusterName, String con
var context = AccessContext.builder()
.cluster(clusterName)
.connect(connectName)
.connectActions(ConnectAction.VIEW, ConnectAction.EDIT)
.connectActions(ConnectAction.DELETE)
.operationName("deleteConnector")
.operationParams(Map.of(CONNECTOR_NAME, connectName))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ public enum ConnectAction implements PermissibleAction {
VIEW,
EDIT,
CREATE,
DELETE,
RESTART

;

public static final Set<ConnectAction> ALTER_ACTIONS = Set.of(CREATE, EDIT, RESTART);
public static final Set<ConnectAction> ALTER_ACTIONS = Set.of(CREATE, EDIT, DELETE, RESTART);

@Nullable
public static ConnectAction fromString(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const PreviewModal: React.FC<InfoModalProps> = ({
<div>
<InputLabel htmlFor="previewFormField">Field</InputLabel>
<Input
autoFocus
type="text"
id="previewFormField"
min="1"
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/common/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ const Search: React.FC<SearchProps> = ({
if (ref.current != null) {
ref.current.value = '';
}
if (onChange) {
onChange('');
}
};

return (
Expand Down

0 comments on commit e280c8e

Please sign in to comment.