diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/ConverterService.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/ConverterService.java index 8bb5973137..bc6613a03e 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/ConverterService.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/ConverterService.java @@ -27,7 +27,6 @@ import org.dspace.app.rest.projection.DefaultProjection; import org.dspace.app.rest.projection.Projection; import org.dspace.app.rest.security.DSpacePermissionEvaluator; import org.dspace.app.rest.utils.Utils; -import org.dspace.authorize.AuthorizeException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; @@ -37,7 +36,6 @@ import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.hateoas.Link; import org.springframework.hateoas.Resource; -import org.springframework.security.access.AccessDeniedException; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; @@ -95,7 +93,8 @@ public class ConverterService { DSpaceConverter converter = requireConverter(modelObject.getClass()); R restObject = converter.convert(transformedModel, projection); if (restObject instanceof BaseObjectRest) { - if (!dSpacePermissionEvaluator.hasPermission(SecurityContextHolder.getContext().getAuthentication(), restObject, "READ")) { + if (!dSpacePermissionEvaluator.hasPermission(SecurityContextHolder.getContext().getAuthentication(), + restObject, "READ")) { log.info("Access denied on " + restObject.getClass()); return null; } diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthenticationStatusRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthenticationStatusRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..64ec0dc35a --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthenticationStatusRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.AuthenticationStatusRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class AuthenticationStatusRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(AuthenticationStatusRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthnRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthnRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..e4e1c4a5b9 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthnRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.AuthnRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class AuthnRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(AuthnRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthorizationFeatureRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthorizationFeatureRestPermissionEvaluatorPlugin.java index 6b8a8af4c4..3552c47994 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthorizationFeatureRestPermissionEvaluatorPlugin.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthorizationFeatureRestPermissionEvaluatorPlugin.java @@ -1,10 +1,16 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ package org.dspace.app.rest.security; import java.io.Serializable; import org.apache.commons.lang3.StringUtils; import org.dspace.app.rest.model.AuthorizationFeatureRest; -import org.dspace.app.rest.model.PoolTaskRest; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Component; diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthorizationRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthorizationRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..a7aea929c0 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AuthorizationRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.AuthorizationRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class AuthorizationRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(AuthorizationRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/BitstreamFormatRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/BitstreamFormatRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..f1f6d3d394 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/BitstreamFormatRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.BitstreamFormatRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class BitstreamFormatRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(BitstreamFormatRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/BrowseIndexRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/BrowseIndexRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..30ed782515 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/BrowseIndexRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.BrowseIndexRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class BrowseIndexRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(BrowseIndexRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/DiscoveryResultRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/DiscoveryResultRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..01c3537d02 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/DiscoveryResultRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.DiscoveryResultsRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class DiscoveryResultRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(DiscoveryResultsRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/EntityTypeRestPermissionEvaluator.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/EntityTypeRestPermissionEvaluator.java new file mode 100644 index 0000000000..cc57753033 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/EntityTypeRestPermissionEvaluator.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.EntityTypeRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class EntityTypeRestPermissionEvaluator extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(EntityTypeRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ExternalSourceEntryRestPermissionEvaluator.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ExternalSourceEntryRestPermissionEvaluator.java new file mode 100644 index 0000000000..3d1a20fd8b --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ExternalSourceEntryRestPermissionEvaluator.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.ExternalSourceEntryRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class ExternalSourceEntryRestPermissionEvaluator extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(ExternalSourceEntryRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ExternalSourceRestPermissionEvaluator.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ExternalSourceRestPermissionEvaluator.java new file mode 100644 index 0000000000..536c55d674 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ExternalSourceRestPermissionEvaluator.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.ExternalSourceRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class ExternalSourceRestPermissionEvaluator extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(ExternalSourceRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/FacetConfigurationRestPermissionEvaluator.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/FacetConfigurationRestPermissionEvaluator.java new file mode 100644 index 0000000000..2d46a9c02c --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/FacetConfigurationRestPermissionEvaluator.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.FacetConfigurationRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class FacetConfigurationRestPermissionEvaluator extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(FacetConfigurationRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/HarvestedCollectionRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/HarvestedCollectionRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..0abe88e3bb --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/HarvestedCollectionRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.HarvestedCollectionRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class HarvestedCollectionRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(HarvestedCollectionRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/HarvesterMetadataRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/HarvesterMetadataRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..76fae4f637 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/HarvesterMetadataRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.HarvesterMetadataRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class HarvesterMetadataRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(HarvesterMetadataRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/MetadataFieldRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/MetadataFieldRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..b78f2ddbd0 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/MetadataFieldRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.MetadataFieldRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class MetadataFieldRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(MetadataFieldRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/MetadataSchemaRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/MetadataSchemaRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..5b4094960f --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/MetadataSchemaRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.MetadataSchemaRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class MetadataSchemaRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(MetadataSchemaRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/RelationshipRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/RelationshipRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..999066840b --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/RelationshipRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.RelationshipRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class RelationshipRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(RelationshipRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/RelationshipTypeRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/RelationshipTypeRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..c7305808b5 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/RelationshipTypeRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.RelationshipTypeRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class RelationshipTypeRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(RelationshipTypeRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/RestObjectPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/RestObjectPermissionEvaluatorPlugin.java index 855519ccc2..f35b0d26ef 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/RestObjectPermissionEvaluatorPlugin.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/RestObjectPermissionEvaluatorPlugin.java @@ -35,7 +35,8 @@ public abstract class RestObjectPermissionEvaluatorPlugin implements RestPermis public boolean hasPermission(Authentication authentication, Object targetDomainObject, Object permission) { BaseObjectRest restObject = (BaseObjectRest) targetDomainObject; - return hasPermission(authentication, restObject.getId(), StringUtils.upperCase(restObject.getType()), permission); + return hasPermission(authentication, restObject.getId(), StringUtils.upperCase(restObject.getType()), + permission); } @Override diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ScriptRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ScriptRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..116f5adf1c --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ScriptRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.ScriptRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class ScriptRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(ScriptRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchConfigurationRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchConfigurationRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..a0a7af1b85 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchConfigurationRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.SearchConfigurationRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class SearchConfigurationRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(SearchConfigurationRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchEventRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchEventRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..5456621eb7 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchEventRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.SearchEventRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class SearchEventRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(SearchEventRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchResultsRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchResultsRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..3cd67088ba --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchResultsRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.SearchResultsRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class SearchResultsRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(SearchResultsRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchSupportRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchSupportRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..d01b1e2111 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SearchSupportRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.SearchSupportRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class SearchSupportRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(SearchSupportRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/StatisticsSupportRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/StatisticsSupportRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..13d0632da6 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/StatisticsSupportRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.StatisticsSupportRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class StatisticsSupportRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(StatisticsSupportRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissionDefinitionRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissionDefinitionRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..8bbf1d3803 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissionDefinitionRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.SubmissionDefinitionRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class SubmissionDefinitionRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(SubmissionDefinitionRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissionFormRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissionFormRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..4c582d4a3b --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissionFormRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.SubmissionFormRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class SubmissionFormRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(SubmissionFormRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissionUploadRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissionUploadRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..1f51050d76 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissionUploadRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.SubmissionUploadRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class SubmissionUploadRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(SubmissionUploadRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissonSectionRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissonSectionRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..d6fad0e42d --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/SubmissonSectionRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.SubmissionSectionRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class SubmissonSectionRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(SubmissionSectionRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/TemplateItemRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/TemplateItemRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..1cdd5a291c --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/TemplateItemRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.TemplateItemRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class TemplateItemRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(TemplateItemRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ViewEventRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ViewEventRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..c8e2a0585a --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/ViewEventRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.ViewEventRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class ViewEventRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(ViewEventRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/WorkflowActionRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/WorkflowActionRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..9b1ded9f9c --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/WorkflowActionRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.WorkflowActionRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class WorkflowActionRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(WorkflowActionRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/WorkflowDefinitionRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/WorkflowDefinitionRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..6308ecf1f1 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/WorkflowDefinitionRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.WorkflowDefinitionRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class WorkflowDefinitionRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(WorkflowDefinitionRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/WorkflowStepRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/WorkflowStepRestPermissionEvaluatorPlugin.java new file mode 100644 index 0000000000..7292f1d967 --- /dev/null +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/WorkflowStepRestPermissionEvaluatorPlugin.java @@ -0,0 +1,27 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.rest.security; + +import java.io.Serializable; + +import org.apache.commons.lang3.StringUtils; +import org.dspace.app.rest.model.WorkflowStepRest; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +@Component +public class WorkflowStepRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin { + @Override + public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, + DSpaceRestPermission restPermission) { + if (!StringUtils.equalsIgnoreCase(WorkflowStepRest.NAME, targetType)) { + return false; + } + return true; + } +} diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/AuthorizationFeatureServiceIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/AuthorizationFeatureServiceIT.java index f73ed06357..d53bdc92c8 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/AuthorizationFeatureServiceIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/AuthorizationFeatureServiceIT.java @@ -22,7 +22,6 @@ import org.dspace.app.rest.authorization.AlwaysTrueFeature; import org.dspace.app.rest.authorization.AuthorizationFeature; import org.dspace.app.rest.authorization.AuthorizationFeatureService; import org.dspace.app.rest.authorization.TrueForAdminsFeature; -import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.converter.SiteConverter; import org.dspace.app.rest.model.CollectionRest; import org.dspace.app.rest.model.SiteRest; diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/AuthorizationRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/AuthorizationRestRepositoryIT.java index ac26ec001b..80a825fad9 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/AuthorizationRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/AuthorizationRestRepositoryIT.java @@ -32,7 +32,6 @@ import org.dspace.app.rest.builder.CommunityBuilder; import org.dspace.app.rest.builder.EPersonBuilder; import org.dspace.app.rest.builder.GroupBuilder; import org.dspace.app.rest.converter.CommunityConverter; -import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.converter.EPersonConverter; import org.dspace.app.rest.converter.SiteConverter; import org.dspace.app.rest.matcher.AuthorizationMatcher; diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/BitstreamFormatRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/BitstreamFormatRestRepositoryIT.java index 45077f2e8f..a35ff55ad8 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/BitstreamFormatRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/BitstreamFormatRestRepositoryIT.java @@ -28,7 +28,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.dspace.app.rest.builder.BitstreamFormatBuilder; import org.dspace.app.rest.builder.EPersonBuilder; import org.dspace.app.rest.converter.BitstreamFormatConverter; -import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.matcher.BitstreamFormatMatcher; import org.dspace.app.rest.matcher.HalMatcher; import org.dspace.app.rest.model.BitstreamFormatRest; @@ -464,7 +463,8 @@ public class BitstreamFormatRestRepositoryIT extends AbstractControllerIntegrati .build(); context.restoreAuthSystemState(); - BitstreamFormatRest bitstreamFormatRest = bitstreamFormatConverter.convert(bitstreamFormat1, Projection.DEFAULT); + BitstreamFormatRest bitstreamFormatRest = bitstreamFormatConverter.convert(bitstreamFormat1, + Projection.DEFAULT); String token = getAuthToken(admin.getEmail(), password); //Update but id in body is not same id as in URL bitstreamFormatRest.setShortDescription("Test short UPDATED"); diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/CollectionRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/CollectionRestRepositoryIT.java index e5c4f9d066..653b18c277 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/CollectionRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/CollectionRestRepositoryIT.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.dspace.app.rest.builder.CollectionBuilder; import org.dspace.app.rest.builder.CommunityBuilder; import org.dspace.app.rest.converter.CollectionConverter; -import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.matcher.CollectionMatcher; import org.dspace.app.rest.matcher.CommunityMatcher; import org.dspace.app.rest.matcher.HalMatcher; diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/CommunityRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/CommunityRestRepositoryIT.java index c3846b4119..a52679a6ac 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/CommunityRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/CommunityRestRepositoryIT.java @@ -33,7 +33,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.dspace.app.rest.builder.CollectionBuilder; import org.dspace.app.rest.builder.CommunityBuilder; import org.dspace.app.rest.converter.CommunityConverter; -import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.matcher.CommunityMatcher; import org.dspace.app.rest.matcher.HalMatcher; import org.dspace.app.rest.matcher.MetadataMatcher; diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataSchemaRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataSchemaRestRepositoryIT.java index e1e6ba87a0..8a4713e9bd 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataSchemaRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataSchemaRestRepositoryIT.java @@ -22,7 +22,6 @@ import java.util.concurrent.atomic.AtomicReference; import com.fasterxml.jackson.databind.ObjectMapper; import org.dspace.app.rest.builder.MetadataSchemaBuilder; -import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.converter.MetadataSchemaConverter; import org.dspace.app.rest.matcher.HalMatcher; import org.dspace.app.rest.matcher.MetadataschemaMatcher; diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/CCLicenseFeatureRestIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/CCLicenseFeatureRestIT.java index 14c0876aa1..97225d7df0 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/CCLicenseFeatureRestIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/CCLicenseFeatureRestIT.java @@ -16,11 +16,9 @@ import org.dspace.app.rest.builder.CollectionBuilder; import org.dspace.app.rest.builder.CommunityBuilder; import org.dspace.app.rest.builder.ItemBuilder; import org.dspace.app.rest.builder.ResourcePolicyBuilder; -import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.converter.ItemConverter; import org.dspace.app.rest.matcher.AuthorizationMatcher; import org.dspace.app.rest.model.ItemRest; -import org.dspace.app.rest.projection.DefaultProjection; import org.dspace.app.rest.projection.Projection; import org.dspace.app.rest.test.AbstractControllerIntegrationTest; import org.dspace.app.rest.utils.Utils; @@ -28,7 +26,6 @@ import org.dspace.authorize.ResourcePolicy; import org.dspace.content.Collection; import org.dspace.content.Community; import org.dspace.content.Item; -import org.dspace.content.service.ItemService; import org.dspace.core.Constants; import org.dspace.services.ConfigurationService; import org.hamcrest.Matchers; diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/ReinstateFeatureRestIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/ReinstateFeatureRestIT.java index b6622503da..96cd2243fc 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/ReinstateFeatureRestIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/ReinstateFeatureRestIT.java @@ -17,11 +17,9 @@ import org.dspace.app.rest.builder.CommunityBuilder; import org.dspace.app.rest.builder.ItemBuilder; import org.dspace.app.rest.builder.WorkflowItemBuilder; import org.dspace.app.rest.builder.WorkspaceItemBuilder; -import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.converter.ItemConverter; import org.dspace.app.rest.matcher.AuthorizationMatcher; import org.dspace.app.rest.model.ItemRest; -import org.dspace.app.rest.projection.DefaultProjection; import org.dspace.app.rest.projection.Projection; import org.dspace.app.rest.test.AbstractControllerIntegrationTest; import org.dspace.app.rest.utils.Utils; diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/WithdrawFeatureRestIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/WithdrawFeatureRestIT.java index 8f9e870d15..dac47a3a88 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/WithdrawFeatureRestIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/WithdrawFeatureRestIT.java @@ -17,11 +17,9 @@ import org.dspace.app.rest.builder.CommunityBuilder; import org.dspace.app.rest.builder.ItemBuilder; import org.dspace.app.rest.builder.WorkflowItemBuilder; import org.dspace.app.rest.builder.WorkspaceItemBuilder; -import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.converter.ItemConverter; import org.dspace.app.rest.matcher.AuthorizationMatcher; import org.dspace.app.rest.model.ItemRest; -import org.dspace.app.rest.projection.DefaultProjection; import org.dspace.app.rest.projection.Projection; import org.dspace.app.rest.test.AbstractControllerIntegrationTest; import org.dspace.app.rest.utils.Utils;