limits in application.properties
This commit is contained in:
parent
19bc482244
commit
760791578b
|
@ -152,18 +152,14 @@ public class OrganizationController extends AbstractDnetController {
|
|||
}
|
||||
|
||||
@GetMapping("/conflicts/byCountry/{country}")
|
||||
public Collection<Set<OrganizationConflict>> findConflictsByCountry(@PathVariable final String country,
|
||||
@RequestParam(required = false, defaultValue = "1000") final int limit,
|
||||
final Authentication authentication) {
|
||||
public Collection<Set<OrganizationConflict>> findConflictsByCountry(@PathVariable final String country, final Authentication authentication) {
|
||||
|
||||
if (UserInfo.isSuperAdmin(authentication)) {
|
||||
return groupConflicts(conflictGroupViewRepository.findByCountry1OrCountry2(country, country, PageRequest.of(0, limit)).stream());
|
||||
}
|
||||
if (UserInfo.isSuperAdmin(authentication)) { return groupConflicts(conflictGroupViewRepository.findByCountry1OrCountry2(country, country).stream()); }
|
||||
if (UserInfo.isSimpleUser(authentication) || UserInfo.isNationalAdmin(authentication)) {
|
||||
final Stream<ConflictGroupView> list = userCountryRepository.getCountriesForUser(UserInfo.getEmail(authentication))
|
||||
.stream()
|
||||
.filter(country::equalsIgnoreCase)
|
||||
.map(c -> conflictGroupViewRepository.findByCountry1OrCountry2(c, c, PageRequest.of(0, limit)).stream())
|
||||
.map(c -> conflictGroupViewRepository.findByCountry1OrCountry2(c, c).stream())
|
||||
.findFirst()
|
||||
.orElse(Stream.empty());
|
||||
return groupConflicts(list);
|
||||
|
@ -174,7 +170,7 @@ public class OrganizationController extends AbstractDnetController {
|
|||
|
||||
@GetMapping("/duplicates/byCountry/{country}")
|
||||
public Iterable<DuplicateGroupView> findDuplicatesByCountry(@PathVariable final String country,
|
||||
@RequestParam(required = false, defaultValue = "1000") final int limit,
|
||||
@RequestParam(required = false, defaultValue = "${openorgs.findDuplicatesByCountry.limit.default}") final int limit,
|
||||
final Authentication authentication) {
|
||||
|
||||
if (UserInfo.isSuperAdmin(authentication)) { return duplicateGroupViewRepository.findByCountry(country, PageRequest.of(0, limit)); }
|
||||
|
@ -268,7 +264,7 @@ public class OrganizationController extends AbstractDnetController {
|
|||
@GetMapping("/byCountry/{status}/{code}")
|
||||
public List<OrganizationSimpleView> findOrgsByStatusAndCountry(@PathVariable final String status,
|
||||
@PathVariable final String code,
|
||||
@RequestParam(required = false, defaultValue = "1000") final int limit,
|
||||
@RequestParam(required = false, defaultValue = "${openorgs.findOrgsByStatusAndCountry.limit.default}") final int limit,
|
||||
final Authentication authentication) {
|
||||
if (!UserInfo.isSuperAdmin(authentication) && !userCountryRepository.verifyAuthorizationForCountry(code, UserInfo.getEmail(authentication))) {
|
||||
throw new RuntimeException("User not authorized");
|
||||
|
|
|
@ -2,7 +2,6 @@ package eu.dnetlib.organizations.repository.readonly;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import eu.dnetlib.organizations.model.view.ConflictGroupView;
|
||||
|
@ -11,6 +10,6 @@ import eu.dnetlib.organizations.model.view.ConflictGroupViewPK;
|
|||
@Repository
|
||||
public interface ConflictGroupViewRepository extends ReadOnlyRepository<ConflictGroupView, ConflictGroupViewPK> {
|
||||
|
||||
List<ConflictGroupView> findByCountry1OrCountry2(String country1, String country2, Pageable page);
|
||||
List<ConflictGroupView> findByCountry1OrCountry2(String country1, String country2);
|
||||
|
||||
}
|
||||
|
|
|
@ -49,6 +49,9 @@ openaire.api.https.proxy = 10.19.65.35
|
|||
|
||||
openorgs.support.pages = { "Ask a question": "https://www.openaire.eu/support/helpdesk?view=ticket&layout=open", "FAQ": "https://www.openaire.eu/faqs" }
|
||||
|
||||
openorgs.findDuplicatesByCountry.limit.default = 1000
|
||||
openorgs.findOrgsByStatusAndCountry.limit.default = 1000
|
||||
|
||||
openaire.override.logout.url =
|
||||
|
||||
openaire.explore.organization.baseurl = https://explore.openaire.eu/search/organization?organizationId=%s
|
||||
|
|
Loading…
Reference in New Issue