Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter expired permissions from RAS Ga4gh Passports #240

Merged
merged 6 commits into from
Feb 11, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Normalize timestamp to seconds in RASPassPortService.
Updated timestamp calculations to use seconds instead of milliseconds for consistency with expected formats. Adjusted related test cases to align with the updated logic.
  • Loading branch information
Gcolon021 committed Feb 10, 2025

Verified

This commit was signed with the committer’s verified signature.
osmman Tomas Turek
commit 0d713eaa72fa040cb075b6fac8df95eca6bb5fa0
Original file line number Diff line number Diff line change
@@ -166,12 +166,10 @@ public Set<RasDbgapPermission> ga4gpPassportToRasDbgapPermissions(Set<Optional<G

logger.debug("Converting ga4ghPassports to RasDbgapPermissions");
HashSet<RasDbgapPermission> rasDbgapPermissions = new HashSet<>();
long date = Instant.now().toEpochMilli();
long date = Instant.now().toEpochMilli() / 1000;
ga4ghPassports.forEach(ga4ghPassport -> {
if (ga4ghPassport.isPresent()) {
Ga4ghPassportV1 ga4ghPassportV1 = ga4ghPassport.get();
logger.info("ga4gh_passport_v1: {}", ga4ghPassportV1);

rasDbgapPermissions.addAll(ga4ghPassportV1.getRasDbgagPermissions().stream().filter(rasDbgapPermission -> date <= rasDbgapPermission.getExpiration()).collect(Collectors.toSet()));
}
});
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ public void testGa4gpPassportStudies_IsNotNull_And_ExpiredPermissionsExcluded()
@Test
public void testGa4gpPassportStudies_HasCorrectStudies() {
Optional<Passport> passport = JWTUtil.parsePassportJWTV11(exampleRasPassport);
long futureDate = Instant.now().toEpochMilli() + 100000;
long futureDate = (Instant.now().toEpochMilli() / 1000) + 100000;

// Update the expiry date of each permission in our test passport. All permissions in the example passport
// expired in 2022.
@@ -94,8 +94,8 @@ public void testGa4gpPassportStudies_HasCorrectStudies() {
@Test
public void testGa4gpPassportStudies_HalfAreExpired() {
Optional<Passport> passport = JWTUtil.parsePassportJWTV11(exampleRasPassport);
long futureDate = Instant.now().toEpochMilli() + 100000;
long pastDate = Instant.now().toEpochMilli() - 100000;
long futureDate = (Instant.now().toEpochMilli() / 1000) + 100000;
long pastDate = (Instant.now().toEpochMilli() / 1000) - 100000;

List<String> expiredPHS = new ArrayList<>();
List<String> validPHS = new ArrayList<>();