Skip to content

Commit b45534f

Browse files
author
Dennis Labordus
authored
Merge pull request #172 from com-pas/develop
Create a new release
2 parents 5c43142 + e441c49 commit b45534f

File tree

27 files changed

+204
-177
lines changed

27 files changed

+204
-177
lines changed

.github/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPDX-FileCopyrightText: 2021 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
changelog:
6+
exclude:
7+
labels:
8+
- wontfix
9+
- duplicate
10+
- invalid
11+
categories:
12+
- title: New Features
13+
labels:
14+
- enhancement
15+
- title: Bugfixes
16+
labels:
17+
- bug
18+
- title: Tooling changes
19+
labels:
20+
- tooling
21+
- title: Dependency updates
22+
labels:
23+
- dependencies
24+
- title: Other Changes
25+
labels:
26+
- "*"

.github/workflows/automate-projects.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
name: Add issues and pull request to project boards
66

7-
on: [ issues, pull_request ]
7+
on: [ issues, pull_request, pull_request_target ]
88

99
jobs:
1010
github-actions-automate-projects:
1111
runs-on: ubuntu-latest
12+
13+
if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
1214
steps:
1315
- name: add-new-issues-to-repository-based-project-column
1416
uses: docker://takanabe/github-actions-automate-projects:v0.0.1
@@ -19,7 +21,7 @@ jobs:
1921
GITHUB_PROJECT_COLUMN_NAME: To do
2022
- name: add-new-pull-request-to-repository-based-project-column
2123
uses: docker://takanabe/github-actions-automate-projects:v0.0.1
22-
if: github.event_name == 'pull_request' && github.event.action == 'opened'
24+
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'opened'
2325
env:
2426
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2527
GITHUB_PROJECT_URL: https://github.com/com-pas/compas-scl-data-service/projects/1
@@ -33,7 +35,7 @@ jobs:
3335
GITHUB_PROJECT_COLUMN_NAME: To do
3436
- name: add-new-pull-request-to-organization-based-project-column
3537
uses: docker://takanabe/github-actions-automate-projects:v0.0.1
36-
if: github.event_name == 'pull_request' && github.event.action == 'opened'
38+
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'opened'
3739
env:
3840
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_ACTION_SECRET }}
3941
GITHUB_PROJECT_URL: https://github.com/orgs/com-pas/projects/2

.github/workflows/build-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
restore-keys: ${{ runner.os }}-m2
3939

4040
- name: Set up JDK 1.11
41-
uses: actions/setup-java@v2.4.0
41+
uses: actions/setup-java@v2.5.0
4242
with:
4343
distribution: 'zulu'
4444
java-version: '11'

.github/workflows/release-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
4444
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
4545
- name: Set up JDK 1.11
46-
uses: actions/setup-java@v2.4.0
46+
uses: actions/setup-java@v2.5.0
4747
with:
4848
distribution: 'zulu'
4949
java-version: '11'

.github/workflows/sonarcloud-analysis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,26 @@ on:
1212
branches:
1313
- 'main'
1414
- 'develop'
15+
pull_request_target:
16+
branches:
17+
- 'main'
18+
- 'develop'
1519

1620
jobs:
1721
sonar-check:
1822
name: Sonar Check
1923
runs-on: ubuntu-latest
2024
timeout-minutes: 15
2125

26+
if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
2227
steps:
2328
- name: Checkout
2429
uses: actions/checkout@v2
2530
with:
2631
fetch-depth: 0
2732

2833
- name: Set up JDK 11
29-
uses: actions/setup-java@v2.4.0
34+
uses: actions/setup-java@v2.5.0
3035
with:
3136
distribution: 'zulu'
3237
java-version: '11'
@@ -58,4 +63,5 @@ jobs:
5863
-Dsonar.projectKey=com-pas_compas-scl-data-service \
5964
-Dsonar.organization=com-pas \
6065
-Dsonar.host.url=https://sonarcloud.io \
66+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} \
6167
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,8 @@ configured as needed.
8383
- SED_DELETE
8484
- SED_READ
8585
- SED_UPDATE
86+
- STD_CREATE
87+
- STD_DELETE
88+
- STD_READ
89+
- STD_UPDATE
8690

app/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ SPDX-License-Identifier: Apache-2.0
4444
<groupId>org.lfenergy.compas.core</groupId>
4545
<artifactId>commons</artifactId>
4646
</dependency>
47+
<dependency>
48+
<groupId>org.lfenergy.compas.core</groupId>
49+
<artifactId>scl-extension</artifactId>
50+
</dependency>
4751
<dependency>
4852
<groupId>org.lfenergy.compas.core</groupId>
4953
<artifactId>jaxrs-commons</artifactId>

app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasCommonResource.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import io.quarkus.security.Authenticated;
77
import org.eclipse.microprofile.jwt.JsonWebToken;
8-
import org.lfenergy.compas.scl.data.model.SclType;
98
import org.lfenergy.compas.scl.data.rest.UserInfoProperties;
109
import org.lfenergy.compas.scl.data.rest.v1.model.Type;
1110
import org.lfenergy.compas.scl.data.rest.v1.model.TypeListResponse;
1211
import org.lfenergy.compas.scl.data.rest.v1.model.UserInfoResponse;
12+
import org.lfenergy.compas.scl.extensions.model.SclFileType;
1313
import org.slf4j.Logger;
1414
import org.slf4j.LoggerFactory;
1515

@@ -49,10 +49,10 @@ public TypeListResponse list(@HeaderParam("Authorization") String authHeader) {
4949

5050
var response = new TypeListResponse();
5151
response.setTypes(
52-
Arrays.stream(SclType.values())
52+
Arrays.stream(SclFileType.values())
5353
// Filter on the type the user has read rights.
54-
.filter(sclType -> roles.contains(sclType.name() + "_" + READ_ROLE))
55-
.map(sclType -> new Type(sclType.name(), sclType.getDescription()))
54+
.filter(sclFileType -> roles.contains(sclFileType.name() + "_" + READ_ROLE))
55+
.map(sclFileType -> new Type(sclFileType.name(), sclFileType.getDescription()))
5656
.sorted(Comparator.comparing(Type::getDescription))
5757
.collect(Collectors.toList()));
5858
return response;

app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResource.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import io.quarkus.security.Authenticated;
77
import org.eclipse.microprofile.jwt.JsonWebToken;
8-
import org.lfenergy.compas.scl.data.model.SclType;
98
import org.lfenergy.compas.scl.data.model.Version;
109
import org.lfenergy.compas.scl.data.rest.UserInfoProperties;
1110
import org.lfenergy.compas.scl.data.rest.v1.model.*;
1211
import org.lfenergy.compas.scl.data.service.CompasSclDataService;
12+
import org.lfenergy.compas.scl.extensions.model.SclFileType;
1313
import org.slf4j.Logger;
1414
import org.slf4j.LoggerFactory;
1515

@@ -44,7 +44,7 @@ public CompasSclDataResource(CompasSclDataService compasSclDataService) {
4444
@POST
4545
@Consumes(MediaType.APPLICATION_XML)
4646
@Produces(MediaType.APPLICATION_XML)
47-
public CreateResponse create(@PathParam(TYPE_PATH_PARAM) SclType type,
47+
public CreateResponse create(@PathParam(TYPE_PATH_PARAM) SclFileType type,
4848
@Valid CreateRequest request) {
4949
String who = jsonWebToken.getClaim(userInfoProperties.who());
5050
LOGGER.trace("Username used for Who {}", who);
@@ -58,7 +58,7 @@ public CreateResponse create(@PathParam(TYPE_PATH_PARAM) SclType type,
5858
@GET
5959
@Path("/list")
6060
@Produces(MediaType.APPLICATION_XML)
61-
public ListResponse list(@PathParam(TYPE_PATH_PARAM) SclType type) {
61+
public ListResponse list(@PathParam(TYPE_PATH_PARAM) SclFileType type) {
6262
var response = new ListResponse();
6363
response.setItems(compasSclDataService.list(type));
6464
return response;
@@ -67,7 +67,7 @@ public ListResponse list(@PathParam(TYPE_PATH_PARAM) SclType type) {
6767
@GET
6868
@Path("/{" + ID_PATH_PARAM + "}/versions")
6969
@Produces(MediaType.APPLICATION_XML)
70-
public VersionsResponse listVersionsByUUID(@PathParam(TYPE_PATH_PARAM) SclType type,
70+
public VersionsResponse listVersionsByUUID(@PathParam(TYPE_PATH_PARAM) SclFileType type,
7171
@PathParam(ID_PATH_PARAM) UUID id) {
7272
var response = new VersionsResponse();
7373
response.setItems(compasSclDataService.listVersionsByUUID(type, id));
@@ -77,7 +77,7 @@ public VersionsResponse listVersionsByUUID(@PathParam(TYPE_PATH_PARAM) SclType t
7777
@GET
7878
@Path("/{" + ID_PATH_PARAM + "}")
7979
@Produces(MediaType.APPLICATION_XML)
80-
public GetResponse findByUUID(@PathParam(TYPE_PATH_PARAM) SclType type,
80+
public GetResponse findByUUID(@PathParam(TYPE_PATH_PARAM) SclFileType type,
8181
@PathParam(ID_PATH_PARAM) UUID id) {
8282
var response = new GetResponse();
8383
response.setSclData(compasSclDataService.findByUUID(type, id));
@@ -87,7 +87,7 @@ public GetResponse findByUUID(@PathParam(TYPE_PATH_PARAM) SclType type,
8787
@GET
8888
@Path("/{" + ID_PATH_PARAM + "}/{" + VERSION_PATH_PARAM + "}")
8989
@Produces(MediaType.APPLICATION_XML)
90-
public GetResponse findByUUIDAndVersion(@PathParam(TYPE_PATH_PARAM) SclType type,
90+
public GetResponse findByUUIDAndVersion(@PathParam(TYPE_PATH_PARAM) SclFileType type,
9191
@PathParam(ID_PATH_PARAM) UUID id,
9292
@PathParam(VERSION_PATH_PARAM) Version version) {
9393
var response = new GetResponse();
@@ -99,7 +99,7 @@ public GetResponse findByUUIDAndVersion(@PathParam(TYPE_PATH_PARAM) SclType type
9999
@Path("/{" + ID_PATH_PARAM + "}")
100100
@Consumes(MediaType.APPLICATION_XML)
101101
@Produces(MediaType.APPLICATION_XML)
102-
public UpdateResponse update(@PathParam(TYPE_PATH_PARAM) SclType type,
102+
public UpdateResponse update(@PathParam(TYPE_PATH_PARAM) SclFileType type,
103103
@PathParam(ID_PATH_PARAM) UUID id,
104104
@Valid UpdateRequest request) {
105105
String who = jsonWebToken.getClaim(userInfoProperties.who());
@@ -114,15 +114,15 @@ public UpdateResponse update(@PathParam(TYPE_PATH_PARAM) SclType type,
114114
@DELETE
115115
@Path("/{" + ID_PATH_PARAM + "}")
116116
@Produces(MediaType.APPLICATION_XML)
117-
public void deleteAll(@PathParam(TYPE_PATH_PARAM) SclType type,
117+
public void deleteAll(@PathParam(TYPE_PATH_PARAM) SclFileType type,
118118
@PathParam(ID_PATH_PARAM) UUID id) {
119119
compasSclDataService.delete(type, id);
120120
}
121121

122122
@DELETE
123123
@Path("/{" + ID_PATH_PARAM + "}/{" + VERSION_PATH_PARAM + "}")
124124
@Produces(MediaType.APPLICATION_XML)
125-
public void deleteVersion(@PathParam(TYPE_PATH_PARAM) SclType type,
125+
public void deleteVersion(@PathParam(TYPE_PATH_PARAM) SclFileType type,
126126
@PathParam(ID_PATH_PARAM) UUID id,
127127
@PathParam(VERSION_PATH_PARAM) Version version) {
128128
compasSclDataService.delete(type, id, version);

app/src/main/resources/application.properties

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,20 @@ quarkus.http.auth.policy.ISD_DELETE.roles-allowed=ISD_DELETE
157157
quarkus.http.auth.permission.ISD_DELETE_DELETE.paths=/compas-scl-data-service/scl/v1/ISD/*
158158
quarkus.http.auth.permission.ISD_DELETE_DELETE.policy=ISD_DELETE
159159
quarkus.http.auth.permission.ISD_DELETE_DELETE.methods=DELETE
160+
161+
quarkus.http.auth.policy.STD_READ.roles-allowed=STD_READ
162+
quarkus.http.auth.permission.STD_READ_GET.paths=/compas-scl-data-service/scl/v1/STD/*
163+
quarkus.http.auth.permission.STD_READ_GET.policy=STD_READ
164+
quarkus.http.auth.permission.STD_READ_GET.methods=GET
165+
quarkus.http.auth.policy.STD_CREATE.roles-allowed=STD_CREATE
166+
quarkus.http.auth.permission.STD_CREATE_POST.paths=/compas-scl-data-service/scl/v1/STD
167+
quarkus.http.auth.permission.STD_CREATE_POST.policy=STD_CREATE
168+
quarkus.http.auth.permission.STD_CREATE_POST.methods=POST
169+
quarkus.http.auth.policy.STD_UPDATE.roles-allowed=STD_UPDATE
170+
quarkus.http.auth.permission.STD_UPDATE_PUT.paths=/compas-scl-data-service/scl/v1/STD/*
171+
quarkus.http.auth.permission.STD_UPDATE_PUT.policy=STD_UPDATE
172+
quarkus.http.auth.permission.STD_UPDATE_PUT.methods=PUT
173+
quarkus.http.auth.policy.STD_DELETE.roles-allowed=STD_DELETE
174+
quarkus.http.auth.permission.STD_DELETE_DELETE.paths=/compas-scl-data-service/scl/v1/STD/*
175+
quarkus.http.auth.permission.STD_DELETE_DELETE.policy=STD_DELETE
176+
quarkus.http.auth.permission.STD_DELETE_DELETE.methods=DELETE

0 commit comments

Comments
 (0)