Skip to content

Commit 77f1ec9

Browse files
authored
BE: RBAC: Skip rbac checks in case of app config (#4078)
1 parent 3cde6c2 commit 77f1ec9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/rbac/AccessControlService.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
@Slf4j
5252
public class AccessControlService {
5353

54+
private static final String ACCESS_DENIED = "Access denied";
55+
5456
@Nullable
5557
private final InMemoryReactiveClientRegistrationRepository clientRegistrationRepository;
5658
private final RoleBasedAccessControlProperties properties;
@@ -97,6 +99,17 @@ public Mono<Void> validateAccess(AccessContext context) {
9799
return Mono.empty();
98100
}
99101

102+
if (CollectionUtils.isNotEmpty(context.getApplicationConfigActions())) {
103+
return getUser()
104+
.doOnNext(user -> {
105+
boolean accessGranted = isApplicationConfigAccessible(context, user);
106+
107+
if (!accessGranted) {
108+
throw new AccessDeniedException(ACCESS_DENIED);
109+
}
110+
}).then();
111+
}
112+
100113
return getUser()
101114
.doOnNext(user -> {
102115
boolean accessGranted =
@@ -113,7 +126,7 @@ && isAclAccessible(context, user)
113126
&& isAuditAccessible(context, user);
114127

115128
if (!accessGranted) {
116-
throw new AccessDeniedException("Access denied");
129+
throw new AccessDeniedException(ACCESS_DENIED);
117130
}
118131
})
119132
.then();

0 commit comments

Comments
 (0)