diff options
author | Antoine Vigneau <antoine.vigneau@sonarsource.com> | 2023-08-03 17:01:07 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-08-04 20:04:15 +0000 |
commit | 97f8a1b245f9a3b1d58ad30be47d7c69dc1f28d0 (patch) | |
tree | 7107565efd41a4b251cb60c253045fd468cea76e | |
parent | 403184b1e34b1697c7913a3ede51343567f5e5cb (diff) | |
download | sonarqube-97f8a1b245f9a3b1d58ad30be47d7c69dc1f28d0.tar.gz sonarqube-97f8a1b245f9a3b1d58ad30be47d7c69dc1f28d0.zip |
SONAR-19789 Return initial_perm_sync in /api/components/show
6 files changed, 22 insertions, 5 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectDto.java index dac8567ad3d..b26f5fbb94f 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectDto.java @@ -33,6 +33,7 @@ public class ProjectDto extends EntityDto { private String tags; private long createdAt; private long updatedAt; + private String initialPermSync; public long getCreatedAt() { return createdAt; @@ -113,4 +114,13 @@ public class ProjectDto extends EntityDto { this.qualifier = qualifier; return this; } + + public String getInitialPermSync() { + return initialPermSync; + } + + public ProjectDto setInitialPermSync(@Nullable String initialPermSync) { + this.initialPermSync = initialPermSync; + return this; + } } diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml index dd94c2f4f37..17bfd0b7209 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml @@ -11,7 +11,8 @@ p.tags as tagsString, p.private as isPrivate, p.created_at as createdAt, - p.updated_at as updatedAt + p.updated_at as updatedAt, + p.initial_perm_sync as initialPermSync </sql> <select id="selectAllProjectUuids" resultType="String"> @@ -163,7 +164,8 @@ private, tags, created_at, - updated_at + updated_at, + initial_perm_sync ) VALUES ( #{kee,jdbcType=VARCHAR}, @@ -174,7 +176,8 @@ #{isPrivate,jdbcType=BOOLEAN}, #{tagsString, jdbcType=VARCHAR}, #{createdAt,jdbcType=BIGINT}, - #{updatedAt,jdbcType=BIGINT} + #{updatedAt,jdbcType=BIGINT}, + #{initialPermSync,jdbcType=VARCHAR} ) </insert> diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/component/ws/ShowActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/component/ws/ShowActionIT.java index a99b7cdba70..6cdec2ca0ea 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/component/ws/ShowActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/component/ws/ShowActionIT.java @@ -478,7 +478,8 @@ public class ShowActionIT { .setName("Java Markdown") .setDescription("Java Markdown Project") .setQualifier(Qualifiers.PROJECT), - p -> p.setTagsString("language, plugin")); + p -> p.setTagsString("language, plugin") + .setInitialPermSync("FINISHED")); ComponentDto mainBranch = projectData.getMainBranchComponent(); userSession.addProjectPermission(USER, projectData.getProjectDto()) .registerBranches(projectData.getMainBranchDto()); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/ComponentDtoToWsComponent.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/ComponentDtoToWsComponent.java index 8054a7745d0..07e148edf8f 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/ComponentDtoToWsComponent.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/ComponentDtoToWsComponent.java @@ -51,6 +51,7 @@ class ComponentDtoToWsComponent { .setQualifier(project.getQualifier()); ofNullable(emptyToNull(project.getDescription())).ifPresent(wsComponent::setDescription); + ofNullable(emptyToNull(project.getInitialPermSync())).ifPresent(wsComponent::setInitialPermSync); ofNullable(lastAnalysis).ifPresent( analysis -> { wsComponent.setAnalysisDate(formatDateTime(analysis.getCreatedAt())); diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/component/ws/show-example.json b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/component/ws/show-example.json index 26799f51714..9ff5afb9569 100644 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/component/ws/show-example.json +++ b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/component/ws/show-example.json @@ -29,7 +29,8 @@ "language", "plugin" ], - "visibility": "private" + "visibility": "private", + "initialPermSync": "FINISHED" } ] } diff --git a/sonar-ws/src/main/protobuf/ws-components.proto b/sonar-ws/src/main/protobuf/ws-components.proto index d51a8a2805b..f25736afaee 100644 --- a/sonar-ws/src/main/protobuf/ws-components.proto +++ b/sonar-ws/src/main/protobuf/ws-components.proto @@ -114,6 +114,7 @@ message Component { optional string version = 19; optional string pullRequest = 20; optional bool needIssueSync = 21; + optional string initialPermSync = 22; message Tags { repeated string tags = 1; |