use filter query to retrieve entity types with submit authorization

This commit is contained in:
Sascha Szott
2025-05-27 19:45:42 +02:00
committed by GitHub
parent cac7eec084
commit 15d4c0b9e0

View File

@@ -124,9 +124,11 @@ public class EntityTypeServiceImpl implements EntityTypeService {
public List<String> getSubmitAuthorizedTypes(Context context)
throws SQLException, SolrServerException, IOException {
List<String> types = new ArrayList<>();
SolrQuery sQuery = new SolrQuery("*:*");
if (!authorizeService.isAdmin(context)) {
StringBuilder query = new StringBuilder();
org.dspace.eperson.EPerson currentUser = context.getCurrentUser();
if (!authorizeService.isAdmin(context)) {
String userId = "";
if (currentUser != null) {
userId = currentUser.getID().toString();
@@ -137,11 +139,8 @@ public class EntityTypeServiceImpl implements EntityTypeService {
query.append(" OR g").append(group.getID());
}
query.append(")");
} else {
query.append("*:*");
sQuery.addFilterQuery(query.toString());
}
SolrQuery sQuery = new SolrQuery(query.toString());
sQuery.addFilterQuery("search.resourcetype:" + IndexableCollection.TYPE);
sQuery.setRows(0);
sQuery.addFacetField("search.entitytype");