Add fix from DS-4530

This commit is contained in:
Pasquale Cavallo
2020-08-03 14:22:48 +02:00
parent e35084cf23
commit 774e3893f9
2 changed files with 13 additions and 1 deletions

View File

@@ -323,6 +323,14 @@
<artifactId>apache-jena-libs</artifactId>
<type>pom</type>
</dependency>
<!-- This was added to support the pubmed api call -->
<!-- Makes runtime operations in Jersey Dependency Injection -->
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>

View File

@@ -34,6 +34,7 @@ import org.dspace.app.rest.security.DSpacePermissionEvaluator;
import org.dspace.app.rest.security.WebSecurityExpressionEvaluator;
import org.dspace.app.rest.utils.Utils;
import org.dspace.services.RequestService;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
@@ -51,6 +52,8 @@ import org.springframework.stereotype.Service;
/**
* Converts domain objects from the DSpace service layer to rest objects, and from rest objects to resource
* objects, applying {@link Projection}s where applicable.
*
* @author Luca Giamminonni (luca.giamminonni at 4science dot it)
*/
@Service
public class ConverterService {
@@ -150,7 +153,8 @@ public class ConverterService {
.getResourceRepositoryByCategoryAndModel(baseObjectRest.getCategory(), baseObjectRest.getType());
Annotation preAuthorize = null;
int maxDepth = 0;
for (Method m : repositoryToUse.getClass().getMethods()) {
// DS-4530 exclude the AOP Proxy from determining the annotations
for (Method m : AopUtils.getTargetClass(repositoryToUse).getMethods()) {
if (StringUtils.equalsIgnoreCase(m.getName(), "findOne")) {
int depth = howManySuperclass(m.getDeclaringClass());
if (depth > maxDepth) {