From 7b60c021ad4d520c608d552087c28ab61c6c1ad7 Mon Sep 17 00:00:00 2001
From: Katherine Thiessen
Date: Wed, 2 Nov 2022 13:23:07 -0500
Subject: [PATCH 1/4] fixing bug preventing managers from sharing project
samples
---
.../service/impl/sample/SampleServiceImpl.java | 13 ++++++-------
.../irida/ria/web/projects/ProjectSamplesPage.xml | 0
...ojectSamplesView.xml => ProjectShareSamples.xml} | 4 ++--
3 files changed, 8 insertions(+), 9 deletions(-)
create mode 100644 src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesPage.xml
rename src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/{ProjectSamplesView.xml => ProjectShareSamples.xml} (98%)
diff --git a/src/main/java/ca/corefacility/bioinformatics/irida/service/impl/sample/SampleServiceImpl.java b/src/main/java/ca/corefacility/bioinformatics/irida/service/impl/sample/SampleServiceImpl.java
index c64b15d85f6..69dcdeed60c 100644
--- a/src/main/java/ca/corefacility/bioinformatics/irida/service/impl/sample/SampleServiceImpl.java
+++ b/src/main/java/ca/corefacility/bioinformatics/irida/service/impl/sample/SampleServiceImpl.java
@@ -345,7 +345,7 @@ public Sample getSampleBySampleName(Project project, String sampleName) {
*/
@Override
@Transactional(readOnly = true)
- @PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_SEQUENCER') or hasPermission(#project, 'canReadProject')")
+ @PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_SEQUENCER') or hasPermission(#projectIds, 'canReadProject')")
public Map> getSampleIdsBySampleNameForProjects(List projectIds,
List sampleNames) {
return sampleRepository.getSampleIdsBySampleNameInProjects(projectIds, sampleNames)
@@ -673,8 +673,9 @@ public List getQCEntriesForSample(Sample sample) {
public Map> getQCEntriesForSamples(List samples) {
return qcEntryRepository.getQCEntriesForSamples(samples)
.stream()
- .collect(Collectors.groupingBy(sampleQCEntryTuple -> (Long) sampleQCEntryTuple.get(0), Collectors
- .mapping(sampleQCEntryTuple -> (QCEntry) sampleQCEntryTuple.get(1), Collectors.toList())));
+ .collect(Collectors.groupingBy(sampleQCEntryTuple -> (Long) sampleQCEntryTuple.get(0),
+ Collectors.mapping(sampleQCEntryTuple -> (QCEntry) sampleQCEntryTuple.get(1),
+ Collectors.toList())));
}
/**
@@ -835,9 +836,7 @@ public List getSamplesCreatedGrouped(Date createdDate, Statist
public Map getCoverageForSamplesInProject(Project project, List sampleIds) {
return psjRepository.calculateCoverageForSamplesInProject(project, sampleIds)
.stream()
- .collect(HashMap::new,
- (sampleCoverageMap, sampleCoverageTuple) -> sampleCoverageMap
- .put((Long) sampleCoverageTuple.get(0), (Long) sampleCoverageTuple.get(1)),
- Map::putAll);
+ .collect(HashMap::new, (sampleCoverageMap, sampleCoverageTuple) -> sampleCoverageMap.put(
+ (Long) sampleCoverageTuple.get(0), (Long) sampleCoverageTuple.get(1)), Map::putAll);
}
}
diff --git a/src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesPage.xml b/src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesPage.xml
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesView.xml b/src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectShareSamples.xml
similarity index 98%
rename from src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesView.xml
rename to src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectShareSamples.xml
index 9002f9e289d..fb97d888d14 100644
--- a/src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesView.xml
+++ b/src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectShareSamples.xml
@@ -1,6 +1,6 @@
-
+
@@ -26,7 +26,7 @@
-
+
From cd824a2dbd4685dde22df8ae94f90ba7ac4eee56 Mon Sep 17 00:00:00 2001
From: Katherine Thiessen
Date: Wed, 2 Nov 2022 13:24:42 -0500
Subject: [PATCH 2/4] fixing seleniums tests to actually use a manager
---
.../projects/ProjectSamplesPageIT.java | 2 +-
.../projects/ProjectShareSamplesIT.java | 2 +-
.../ria/web/projects/ProjectSamplesPage.xml | 123 ++++++++++++++++++
3 files changed, 125 insertions(+), 2 deletions(-)
diff --git a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/ProjectSamplesPageIT.java b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/ProjectSamplesPageIT.java
index a7df60c973a..24a59c51744 100644
--- a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/ProjectSamplesPageIT.java
+++ b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/ProjectSamplesPageIT.java
@@ -19,7 +19,7 @@
* Integration test to ensure that the Project Details Page.
*
*/
-@DatabaseSetup("/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesView.xml")
+@DatabaseSetup("/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesPage.xml")
public class ProjectSamplesPageIT extends AbstractIridaUIITChromeDriver {
String FIRST_SAMPLE_NAME = "sample55422r";
String SECOND_SAMPLE_NAME = "sample-5-fg-22";
diff --git a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/ProjectShareSamplesIT.java b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/ProjectShareSamplesIT.java
index b9273d1da63..723e12eb1bc 100644
--- a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/ProjectShareSamplesIT.java
+++ b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/ProjectShareSamplesIT.java
@@ -12,7 +12,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
-@DatabaseSetup("/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesView.xml")
+@DatabaseSetup("/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectShareSamples.xml")
public class ProjectShareSamplesIT extends AbstractIridaUIITChromeDriver {
private ShareSamplesPage shareSamplesPage = ShareSamplesPage.initPage(driver());
diff --git a/src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesPage.xml b/src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesPage.xml
index e69de29bb2d..735668ebddf 100644
--- a/src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesPage.xml
+++ b/src/test/resources/ca/corefacility/bioinformatics/irida/ria/web/projects/ProjectSamplesPage.xml
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From 91dbcf19ba67d990ea720d1a1167480722b6a591 Mon Sep 17 00:00:00 2001
From: Katherine Thiessen
Date: Wed, 2 Nov 2022 13:25:08 -0500
Subject: [PATCH 3/4] updating change log
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 52af82abd15..537f02e034a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
## [22.09.2]
* [UI]: Fixed bug causing associated project samples to be added to the cart with the wrong project identifier. See [PR 1395](https://github.com/phac-nml/irida/pull/1395)
+* [UI]: Fixed bug preventing managers from sharing project samples. See [PR 1398](https://github.com/phac-nml/irida/pull/1398)
## [22.09.1] - 2022/10/21
* [UI]: Fixed when sharing or exporting sample on the project sample page, and other minor bugs. See [PR 1382](https://github.com/phac-nml/irida/pull/1382)
From d41037e90b005f2082aa0a0673ca5bc6f4030d8c Mon Sep 17 00:00:00 2001
From: Katherine Thiessen
Date: Wed, 2 Nov 2022 13:55:28 -0500
Subject: [PATCH 4/4] updating change log
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 537f02e034a..b250668677f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,7 @@
## [22.09.2]
* [UI]: Fixed bug causing associated project samples to be added to the cart with the wrong project identifier. See [PR 1395](https://github.com/phac-nml/irida/pull/1395)
-* [UI]: Fixed bug preventing managers from sharing project samples. See [PR 1398](https://github.com/phac-nml/irida/pull/1398)
+* [Developer/UI]: Fixed bug preventing managers from sharing project samples. See [PR 1398](https://github.com/phac-nml/irida/pull/1398)
## [22.09.1] - 2022/10/21
* [UI]: Fixed when sharing or exporting sample on the project sample page, and other minor bugs. See [PR 1382](https://github.com/phac-nml/irida/pull/1382)