Skip to content

Commit 89f8c22

Browse files
author
Leshe4ka
committed
Merge branch 'main' of github.com:kafbat/kafka-ui into kafbat/203
2 parents 94f3640 + 19e95fe commit 89f8c22

File tree

4 files changed

+11
-40
lines changed

4 files changed

+11
-40
lines changed

api/src/main/java/io/kafbat/ui/serdes/builtin/ProtobufFileSerde.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import io.kafbat.ui.serdes.BuiltInSerde;
5050
import io.kafbat.ui.util.jsonschema.ProtobufSchemaConverter;
5151
import java.io.ByteArrayInputStream;
52+
import java.nio.file.FileVisitOption;
5253
import java.nio.file.Files;
5354
import java.nio.file.Path;
5455
import java.util.Collection;
@@ -404,7 +405,7 @@ private Loader createFilesLoader(Map<String, ProtoFile> files) {
404405
@SneakyThrows
405406
private Map<String, ProtoFile> loadFilesWithLocations() {
406407
Map<String, ProtoFile> filesByLocations = new HashMap<>();
407-
try (var files = Files.walk(baseLocation)) {
408+
try (var files = Files.walk(baseLocation, FileVisitOption.FOLLOW_LINKS)) {
408409
files.filter(p -> !Files.isDirectory(p) && p.toString().endsWith(".proto"))
409410
.forEach(path -> {
410411
// relative path will be used as "import" statement
Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
package io.kafbat.ui.service.rbac.extractor;
22

3-
import io.kafbat.ui.config.auth.LdapProperties;
43
import io.kafbat.ui.model.rbac.Role;
54
import io.kafbat.ui.model.rbac.provider.Provider;
65
import io.kafbat.ui.service.rbac.AccessControlService;
7-
import java.util.List;
8-
import java.util.Map;
96
import java.util.Set;
107
import java.util.stream.Collectors;
118
import lombok.extern.slf4j.Slf4j;
@@ -14,25 +11,26 @@
1411
import org.springframework.ldap.core.support.BaseLdapPathContextSource;
1512
import org.springframework.security.core.GrantedAuthority;
1613
import org.springframework.security.core.authority.SimpleGrantedAuthority;
17-
import org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator;
18-
import org.springframework.util.Assert;
14+
import org.springframework.security.ldap.userdetails.NestedLdapAuthoritiesPopulator;
1915

2016
@Slf4j
21-
public class RbacLdapAuthoritiesExtractor extends DefaultLdapAuthoritiesPopulator {
17+
public class RbacLdapAuthoritiesExtractor extends NestedLdapAuthoritiesPopulator {
2218

2319
private final AccessControlService acs;
24-
private final LdapProperties props;
2520

2621
public RbacLdapAuthoritiesExtractor(ApplicationContext context,
2722
BaseLdapPathContextSource contextSource, String groupFilterSearchBase) {
2823
super(contextSource, groupFilterSearchBase);
2924
this.acs = context.getBean(AccessControlService.class);
30-
this.props = context.getBean(LdapProperties.class);
3125
}
3226

3327
@Override
3428
protected Set<GrantedAuthority> getAdditionalRoles(DirContextOperations user, String username) {
35-
var ldapGroups = getRoles(user.getNameInNamespace(), username);
29+
var ldapGroups = super.getGroupMembershipRoles(user.getNameInNamespace(), username)
30+
.stream()
31+
.map(GrantedAuthority::getAuthority)
32+
.peek(group -> log.trace("Found LDAP group [{}] for user [{}]", group, username))
33+
.collect(Collectors.toSet());
3634

3735
return acs.getRoles()
3836
.stream()
@@ -47,32 +45,4 @@ protected Set<GrantedAuthority> getAdditionalRoles(DirContextOperations user, St
4745
.map(SimpleGrantedAuthority::new)
4846
.collect(Collectors.toSet());
4947
}
50-
51-
private Set<String> getRoles(String userDn, String username) {
52-
var groupSearchBase = props.getGroupFilterSearchBase();
53-
Assert.notNull(groupSearchBase, "groupSearchBase is empty");
54-
55-
var groupRoleAttribute = props.getGroupRoleAttribute();
56-
if (groupRoleAttribute == null) {
57-
58-
groupRoleAttribute = "cn";
59-
}
60-
61-
log.trace(
62-
"Searching for roles for user [{}] with DN [{}], groupRoleAttribute [{}] and filter [{}] in search base [{}]",
63-
username, userDn, groupRoleAttribute, getGroupSearchFilter(), groupSearchBase);
64-
65-
var ldapTemplate = getLdapTemplate();
66-
ldapTemplate.setIgnoreNameNotFoundException(true);
67-
68-
Set<Map<String, List<String>>> userRoles = ldapTemplate.searchForMultipleAttributeValues(
69-
groupSearchBase, getGroupSearchFilter(), new String[] {userDn, username},
70-
new String[] {groupRoleAttribute});
71-
72-
return userRoles.stream()
73-
.map(record -> record.get(getGroupRoleAttribute()).get(0))
74-
.peek(group -> log.trace("Found LDAP group [{}] for user [{}]", group, username))
75-
.collect(Collectors.toSet());
76-
}
77-
7848
}

api/src/main/java/io/kafbat/ui/util/GithubReleaseInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class GithubReleaseInfo {
1111
private static final String GITHUB_LATEST_RELEASE_RETRIEVAL_URL =
1212
"https://api.github.com/repos/kafbat/kafka-ui/releases/latest";
1313

14-
private static final Duration GITHUB_API_MAX_WAIT_TIME = Duration.ofSeconds(2);
14+
private static final Duration GITHUB_API_MAX_WAIT_TIME = Duration.ofSeconds(10);
1515

1616
public record GithubReleaseDto(String html_url, String tag_name, String published_at) {
1717

frontend/src/components/common/Select/Select.styled.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const OptionList = styled.ul`
8181
line-height: 18px;
8282
color: ${({ theme }) => theme.select.color.normal};
8383
overflow-y: auto;
84-
z-index: 10;
84+
z-index: 12;
8585
max-width: 300px;
8686
min-width: 100%;
8787
align-items: center;

0 commit comments

Comments
 (0)