Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1029,9 +1029,11 @@ private static boolean impliesTypePerm(
private class TenantHolder {

private SetMultimap<String, Tuple<String, Boolean>> tenantsMM = null;
private final ImmutableSet<String> allDefinedTenantNames;

public TenantHolder(SecurityDynamicConfiguration<RoleV7> roles, SecurityDynamicConfiguration<TenantV7> definedTenants) {
final Set<Future<Tuple<String, Set<Tuple<String, Boolean>>>>> futures = new HashSet<>(roles.getCEntries().size());
this.allDefinedTenantNames = ImmutableSet.copyOf(definedTenants.getCEntries().keySet());

final ExecutorService execs = Executors.newFixedThreadPool(10);

Expand All @@ -1053,7 +1055,7 @@ public Tuple<String, Set<Tuple<String, Boolean>>> call() throws Exception {

// find Wildcarded tenant patterns
List<String> matchingTenants = WildcardMatcher.from(tenant.getTenant_patterns())
.getMatchAny(definedTenants.getCEntries().keySet(), Collectors.toList());
.getMatchAny(allDefinedTenantNames, Collectors.toList());
for (String matchingTenant : matchingTenants) {
tuples.add(
new Tuple<String, Boolean>(
Expand Down Expand Up @@ -1146,7 +1148,7 @@ public Map<String, Boolean> mapTenants(final User user, Set<String> roles) {
// Indeed, because we don't have control over what will be
// passed on as values of users' attributes, we have to make
// sure that we don't allow them to select tenants that do not exist.
if (ConfigModelV7.this.tenants.getCEntries().keySet().contains(tenant)) {
if (this.allDefinedTenantNames.contains(tenant)) {
result.put(tenant, rw);
}
}
Expand Down
Loading