Loading pom.xml +13 −129 Original line number Diff line number Diff line Loading @@ -3,10 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.4.5</version> <relativePath/> <!-- lookup parent from repository --> <groupId>it.inaf.ia2</groupId> <artifactId>vospace-parent</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <groupId>it.inaf.oats</groupId> <artifactId>vospace-rest</artifactId> Loading @@ -18,134 +17,19 @@ <!-- File catalog repository directory --> <init_database_scripts_path>../../../vospace-file-catalog</init_database_scripts_path> <finalName>${project.artifactId}-${project.version}</finalName> <zonky.postgres-binaries.version>12.5.0</zonky.postgres-binaries.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- Jackson-JAXB compatibility --> <dependency> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-jaxb-annotations</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>it.oats.inaf</groupId> <artifactId>vospace-datamodel</artifactId> <version>1.0-SNAPSHOT</version> <exclusions> <!-- Transitive dependency excluded to avoid duplicated dependency issues. We want to use always the version provided by Spring Boot --> <exclusion> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-jaxb-annotations</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>it.inaf.ia2</groupId> <artifactId>auth-lib</artifactId> <version>2.0.0-SNAPSHOT</version> <artifactId>vospace-parent-classes</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-inline</artifactId> </dependency> <!-- Embedded PostgreSQL: --> <dependency> <groupId>com.opentable.components</groupId> <artifactId>otj-pg-embedded</artifactId> <version>0.13.3</version> <scope>test</scope> </dependency> </dependencies> <profiles> <profile> <id>platform-linux</id> <activation> <os> <family>unix</family> </os> </activation> <dependencies> <dependency> <groupId>io.zonky.test.postgres</groupId> <artifactId>embedded-postgres-binaries-linux-amd64</artifactId> <version>${zonky.postgres-binaries.version}</version> <scope>test</scope> </dependency> </dependencies> </profile> <profile> <id>platform-windows</id> <activation> <os> <family>windows</family> </os> </activation> <dependencies> <dependency> <groupId>io.zonky.test.postgres</groupId> <artifactId>embedded-postgres-binaries-windows-amd64</artifactId> <version>${zonky.postgres-binaries.version}</version> <scope>test</scope> </dependency> </dependencies> </profile> </profiles> <repositories> <repository> <id>ia2-snapshots</id> <name>your custom repo</name> <url>http://repo.ia2.inaf.it/maven/repository/snapshots</url> </repository> </repositories> <build> <finalName>${finalName}</finalName> Loading Loading @@ -173,17 +57,9 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.2</version> <configuration> <trimStackTrace>false</trimStackTrace> </configuration> </plugin> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.8.6</version> <executions> <execution> <goals> Loading @@ -202,4 +78,12 @@ </plugins> </build> <repositories> <repository> <id>ia2-snapshots</id> <name>IA2 snapshot repository</name> <url>http://repo.ia2.inaf.it/maven/repository/snapshots</url> </repository> </repositories> </project> src/main/java/it/inaf/oats/vospace/CreateNodeService.java +2 −2 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ public class CreateNodeService { } if (!NodeUtils.checkIfWritable(parentNode, principal.getName(), principal.getGroups())) { throw new PermissionDeniedException(path); throw PermissionDeniedException.forPath(path); } // Check if node creator property is set. If not set it according to Loading @@ -87,7 +87,7 @@ public class CreateNodeService { } else { if (!creator.equals(principal.getName())) // maybe a more specific exception would be more appropriate? { throw new PermissionDeniedException(path); throw PermissionDeniedException.forPath(path); } } Loading src/main/java/it/inaf/oats/vospace/DeleteNodeController.java +3 −3 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public class DeleteNodeController extends BaseNodeController { if (pathComponents.isEmpty()) { // Manage root node throw new PermissionDeniedException("root"); throw PermissionDeniedException.forPath("/"); } else { Loading @@ -72,7 +72,7 @@ public class DeleteNodeController extends BaseNodeController { } if (!NodeUtils.checkIfWritable(toBeDeletedNode, principal.getName(), principal.getGroups())) { throw new PermissionDeniedException(path); throw PermissionDeniedException.forPath(path); } try { Loading src/main/java/it/inaf/oats/vospace/ErrorController.java 0 → 100644 +20 −0 Original line number Diff line number Diff line /* * This file is part of vospace-rest * Copyright (C) 2021 Istituto Nazionale di Astrofisica * SPDX-License-Identifier: GPL-3.0-or-later */ package it.inaf.oats.vospace; import it.inaf.oats.vospace.exception.DefaultErrorController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.web.bind.annotation.RestController; @RestController public class ErrorController extends DefaultErrorController { @Autowired public ErrorController(ErrorAttributes errorAttributes) { super(errorAttributes); } } src/main/java/it/inaf/oats/vospace/ListNodeController.java +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ public class ListNodeController extends BaseNodeController { } else { if (!NodeUtils.checkIfReadable( optNode.get(), principal.getName(), principal.getGroups())) { throw new PermissionDeniedException(path); throw PermissionDeniedException.forPath(path); } } Loading Loading
pom.xml +13 −129 Original line number Diff line number Diff line Loading @@ -3,10 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.4.5</version> <relativePath/> <!-- lookup parent from repository --> <groupId>it.inaf.ia2</groupId> <artifactId>vospace-parent</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <groupId>it.inaf.oats</groupId> <artifactId>vospace-rest</artifactId> Loading @@ -18,134 +17,19 @@ <!-- File catalog repository directory --> <init_database_scripts_path>../../../vospace-file-catalog</init_database_scripts_path> <finalName>${project.artifactId}-${project.version}</finalName> <zonky.postgres-binaries.version>12.5.0</zonky.postgres-binaries.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- Jackson-JAXB compatibility --> <dependency> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-jaxb-annotations</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>it.oats.inaf</groupId> <artifactId>vospace-datamodel</artifactId> <version>1.0-SNAPSHOT</version> <exclusions> <!-- Transitive dependency excluded to avoid duplicated dependency issues. We want to use always the version provided by Spring Boot --> <exclusion> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-jaxb-annotations</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>it.inaf.ia2</groupId> <artifactId>auth-lib</artifactId> <version>2.0.0-SNAPSHOT</version> <artifactId>vospace-parent-classes</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-inline</artifactId> </dependency> <!-- Embedded PostgreSQL: --> <dependency> <groupId>com.opentable.components</groupId> <artifactId>otj-pg-embedded</artifactId> <version>0.13.3</version> <scope>test</scope> </dependency> </dependencies> <profiles> <profile> <id>platform-linux</id> <activation> <os> <family>unix</family> </os> </activation> <dependencies> <dependency> <groupId>io.zonky.test.postgres</groupId> <artifactId>embedded-postgres-binaries-linux-amd64</artifactId> <version>${zonky.postgres-binaries.version}</version> <scope>test</scope> </dependency> </dependencies> </profile> <profile> <id>platform-windows</id> <activation> <os> <family>windows</family> </os> </activation> <dependencies> <dependency> <groupId>io.zonky.test.postgres</groupId> <artifactId>embedded-postgres-binaries-windows-amd64</artifactId> <version>${zonky.postgres-binaries.version}</version> <scope>test</scope> </dependency> </dependencies> </profile> </profiles> <repositories> <repository> <id>ia2-snapshots</id> <name>your custom repo</name> <url>http://repo.ia2.inaf.it/maven/repository/snapshots</url> </repository> </repositories> <build> <finalName>${finalName}</finalName> Loading Loading @@ -173,17 +57,9 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.2</version> <configuration> <trimStackTrace>false</trimStackTrace> </configuration> </plugin> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.8.6</version> <executions> <execution> <goals> Loading @@ -202,4 +78,12 @@ </plugins> </build> <repositories> <repository> <id>ia2-snapshots</id> <name>IA2 snapshot repository</name> <url>http://repo.ia2.inaf.it/maven/repository/snapshots</url> </repository> </repositories> </project>
src/main/java/it/inaf/oats/vospace/CreateNodeService.java +2 −2 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ public class CreateNodeService { } if (!NodeUtils.checkIfWritable(parentNode, principal.getName(), principal.getGroups())) { throw new PermissionDeniedException(path); throw PermissionDeniedException.forPath(path); } // Check if node creator property is set. If not set it according to Loading @@ -87,7 +87,7 @@ public class CreateNodeService { } else { if (!creator.equals(principal.getName())) // maybe a more specific exception would be more appropriate? { throw new PermissionDeniedException(path); throw PermissionDeniedException.forPath(path); } } Loading
src/main/java/it/inaf/oats/vospace/DeleteNodeController.java +3 −3 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public class DeleteNodeController extends BaseNodeController { if (pathComponents.isEmpty()) { // Manage root node throw new PermissionDeniedException("root"); throw PermissionDeniedException.forPath("/"); } else { Loading @@ -72,7 +72,7 @@ public class DeleteNodeController extends BaseNodeController { } if (!NodeUtils.checkIfWritable(toBeDeletedNode, principal.getName(), principal.getGroups())) { throw new PermissionDeniedException(path); throw PermissionDeniedException.forPath(path); } try { Loading
src/main/java/it/inaf/oats/vospace/ErrorController.java 0 → 100644 +20 −0 Original line number Diff line number Diff line /* * This file is part of vospace-rest * Copyright (C) 2021 Istituto Nazionale di Astrofisica * SPDX-License-Identifier: GPL-3.0-or-later */ package it.inaf.oats.vospace; import it.inaf.oats.vospace.exception.DefaultErrorController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.web.bind.annotation.RestController; @RestController public class ErrorController extends DefaultErrorController { @Autowired public ErrorController(ErrorAttributes errorAttributes) { super(errorAttributes); } }
src/main/java/it/inaf/oats/vospace/ListNodeController.java +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ public class ListNodeController extends BaseNodeController { } else { if (!NodeUtils.checkIfReadable( optNode.get(), principal.getName(), principal.getGroups())) { throw new PermissionDeniedException(path); throw PermissionDeniedException.forPath(path); } } Loading