Unverified Commit ed0cab4a authored by Martin Lowe's avatar Martin Lowe 🇨🇦 Committed by GitHub
Browse files

Add denylist for working groups to filter out certain wgs from the list (#266)

parent cd404a4c
......@@ -13,12 +13,16 @@ package org.eclipsefoundation.react.service.impl;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.json.bind.Jsonb;
......@@ -42,6 +46,8 @@ import io.quarkus.runtime.Startup;
public class DefaultWorkingGroupsService implements WorkingGroupsService {
public static final Logger LOGGER = LoggerFactory.getLogger(DefaultWorkingGroupsService.class);
@ConfigProperty(name = "eclipse.working-groups.deny-list", defaultValue = "")
Instance<List<String>> denyList;
@ConfigProperty(name = "eclipse.working-groups.filepath")
String filepath;
......@@ -62,7 +68,10 @@ public class DefaultWorkingGroupsService implements WorkingGroupsService {
LOGGER.info("Starting init of working group levels static members");
try (InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(filepath)) {
WorkingGroupMap map = json.fromJson(is, WorkingGroupMap.class);
this.wgs = map.getWorkingGroups();
this.wgs = new HashMap<>();
// iterate over wg map entries and only retain entries not in denyList
map.getWorkingGroups().entrySet().stream().filter(entry -> !denyList().contains(entry.getKey()))
.forEach(e -> wgs.put(e.getKey(), e.getValue()));
LOGGER.info("Initialized {} working group", wgs.size());
}
}
......@@ -76,4 +85,8 @@ public class DefaultWorkingGroupsService implements WorkingGroupsService {
public WorkingGroup getByName(String name) {
return wgs.get(name);
}
private List<String> denyList() {
return denyList.stream().flatMap(List::stream).collect(Collectors.toList());
}
}
......@@ -12,6 +12,7 @@ fdn-api/mp-rest/scope=javax.inject.Singleton
## Required for wg interim solution, remove when moved to external API
quarkus.native.resources.includes=working_groups.json,templates/**
eclipse.working-groups.filepath=working_groups.json
eclipse.working-groups.deny-list=openhw-group,opengenesis
## MAILER SETTINGS
quarkus.mailer.auth-methods=DIGEST-MD5 CRAM-SHA256 CRAM-SHA1 CRAM-MD5 PLAIN LOGIN
......
......@@ -5,6 +5,7 @@ fdn-api/mp-rest/scope=javax.inject.Singleton
## Required for wg interim solution, remove when moved to external API
quarkus.native.resources.includes=working_groups.json
eclipse.working-groups.filepath=working_groups.json
eclipse.working-groups.deny-list=openhw-group,opengenesis,gemoc
## DATASOURCE CONFIG
quarkus.datasource.db-kind=mariadb
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment