diff --git a/orcid-api-web/src/main/java/org/orcid/api/memberV2/server/delegator/impl/MemberV2ApiServiceDelegatorImpl.java b/orcid-api-web/src/main/java/org/orcid/api/memberV2/server/delegator/impl/MemberV2ApiServiceDelegatorImpl.java index e0cada2eabc..5777518cca2 100644 --- a/orcid-api-web/src/main/java/org/orcid/api/memberV2/server/delegator/impl/MemberV2ApiServiceDelegatorImpl.java +++ b/orcid-api-web/src/main/java/org/orcid/api/memberV2/server/delegator/impl/MemberV2ApiServiceDelegatorImpl.java @@ -14,7 +14,6 @@ import javax.annotation.Resource; import javax.ws.rs.core.Response; -import org.apache.commons.lang3.StringEscapeUtils; import org.orcid.api.common.util.ActivityUtils; import org.orcid.api.common.util.ApiUtils; import org.orcid.api.common.util.ElementUtils; @@ -57,7 +56,6 @@ import org.orcid.core.manager.read_only.RecordManagerReadOnly; import org.orcid.core.manager.read_only.ResearcherUrlManagerReadOnly; import org.orcid.core.manager.read_only.WorkManagerReadOnly; -import org.orcid.core.togglz.Features; import org.orcid.core.utils.ContributorUtils; import org.orcid.core.utils.SourceUtils; import org.orcid.core.version.impl.Api2_0_LastModifiedDatesHelper; @@ -770,23 +768,14 @@ public Response viewEmails(String orcid) { // return all emails if client has /email/read-private scope orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.EMAIL_READ_PRIVATE); - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - emails = emailManagerReadOnly.getVerifiedEmails(orcid); - } else { - emails = emailManagerReadOnly.getEmails(orcid); - } + emails = emailManagerReadOnly.getVerifiedEmails(orcid); // Lets copy the list so we don't modify the cached collection List filteredList = new ArrayList(emails.getEmails()); emails = new Emails(); emails.setEmails(filteredList); } catch (OrcidAccessControlException e) { - - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - emails = emailManagerReadOnly.getVerifiedEmails(orcid); - } else { - emails = emailManagerReadOnly.getEmails(orcid); - } + emails = emailManagerReadOnly.getVerifiedEmails(orcid); // Lets copy the list so we don't modify the cached collection List filteredList = new ArrayList(emails.getEmails()); diff --git a/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/impl/MemberV3ApiServiceDelegatorImpl.java b/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/impl/MemberV3ApiServiceDelegatorImpl.java index 566294140d3..ab7091f909d 100644 --- a/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/impl/MemberV3ApiServiceDelegatorImpl.java +++ b/orcid-api-web/src/main/java/org/orcid/api/memberV3/server/delegator/impl/MemberV3ApiServiceDelegatorImpl.java @@ -64,7 +64,6 @@ import org.orcid.core.manager.v3.read_only.ResearchResourceManagerReadOnly; import org.orcid.core.manager.v3.read_only.ResearcherUrlManagerReadOnly; import org.orcid.core.manager.v3.read_only.WorkManagerReadOnly; -import org.orcid.core.togglz.Features; import org.orcid.core.utils.SourceEntityUtils; import org.orcid.core.utils.v3.ContributorUtils; import org.orcid.core.utils.v3.SourceUtils; @@ -855,24 +854,14 @@ public Response viewEmails(String orcid) { try { // return all emails if client has /email/read-private scope orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.EMAIL_READ_PRIVATE); - - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - emails = emailManagerReadOnly.getVerifiedEmails(orcid); - } else { - emails = emailManagerReadOnly.getEmails(orcid); - } + emails = emailManagerReadOnly.getVerifiedEmails(orcid); // Lets copy the list so we don't modify the cached collection List filteredList = new ArrayList(emails.getEmails()); emails = new Emails(); emails.setEmails(filteredList); } catch (OrcidAccessControlException e) { - - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - emails = emailManagerReadOnly.getVerifiedEmails(orcid); - } else { - emails = emailManagerReadOnly.getEmails(orcid); - } + emails = emailManagerReadOnly.getVerifiedEmails(orcid); // Lets copy the list so we don't modify the cached collection List filteredList = new ArrayList(emails.getEmails()); @@ -1160,7 +1149,7 @@ public Response viewPersonalDetails(String orcid) { @Override public Response viewPerson(String orcid) { checkProfileStatus(orcid, true); - Person person = personDetailsManagerReadOnly.getPersonDetails(orcid, !Features.HIDE_UNVERIFIED_EMAILS.isActive()); + Person person = personDetailsManagerReadOnly.getPersonDetails(orcid, false); orcidSecurityManager.checkAndFilter(orcid, person); ElementUtils.setPathToPerson(person, orcid); Api3_0LastModifiedDatesHelper.calculateLastModified(person); diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_EmailsTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_EmailsTest.java index 8fe393ceaec..25d8e13026e 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_EmailsTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_EmailsTest.java @@ -1,10 +1,7 @@ package org.orcid.api.memberV2.server.delegator; -import static org.hamcrest.core.AnyOf.anyOf; -import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -14,14 +11,12 @@ import javax.annotation.Resource; import javax.ws.rs.core.Response; -import org.orcid.test.DBUnitTest; -import org.orcid.test.helper.Utils; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.orcid.core.exception.OrcidUnauthorizedException; -import org.orcid.core.togglz.Features; import org.orcid.core.utils.SecurityContextTestUtils; import org.orcid.jaxb.model.common_v2.Visibility; import org.orcid.jaxb.model.groupid_v2.GroupIdRecord; @@ -39,7 +34,9 @@ import org.orcid.jaxb.model.record_v2.ResearcherUrl; import org.orcid.jaxb.model.record_v2.Work; import org.orcid.jaxb.model.record_v2.WorkBulk; +import org.orcid.test.DBUnitTest; import org.orcid.test.OrcidJUnit4ClassRunner; +import org.orcid.test.helper.Utils; import org.springframework.test.context.ContextConfiguration; @RunWith(OrcidJUnit4ClassRunner.class) @@ -142,50 +139,13 @@ public void testViewEmails() { assertEquals("/4444-4444-4444-4443/email", emails.getPath()); Utils.verifyLastModified(emails.getLastModifiedDate()); assertNotNull(emails.getEmails()); - - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - assertEquals(1, emails.getEmails().size()); - Email email = emails.getEmails().get(0); - Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(email.getEmail(), "teddybass3private@semantico.com"); - assertEquals(Visibility.PRIVATE, email.getVisibility()); - assertEquals("APP-5555555555555555", email.retrieveSourcePath()); - assertEquals(true, email.isVerified()); - assertEquals(false, email.isPrimary()); - } else { - assertEquals(3, emails.getEmails().size()); - for (Email email : emails.getEmails()) { - Utils.verifyLastModified(email.getLastModifiedDate()); - assertThat(email.getEmail(), anyOf(is("teddybass2@semantico.com"), is("teddybass3public@semantico.com"), is("teddybass3private@semantico.com"))); - switch (email.getEmail()) { - case "teddybass2@semantico.com": - assertEquals(Visibility.LIMITED, email.getVisibility()); - assertEquals("4444-4444-4444-4443", email.retrieveSourcePath()); - assertEquals(false, email.isVerified()); - assertEquals(false, email.isPrimary()); - break; - case "teddybass3public@semantico.com": - assertEquals(Visibility.PUBLIC, email.getVisibility()); - assertEquals("4444-4444-4444-4443", email.retrieveSourcePath()); - assertEquals(false, email.isVerified()); - assertEquals(false, email.isPrimary()); - break; - case "teddybass3private@semantico.com": - assertEquals(Visibility.PRIVATE, email.getVisibility()); - assertEquals("APP-5555555555555555", email.retrieveSourcePath()); - assertEquals(true, email.isVerified()); - assertEquals(false, email.isPrimary()); - break; - case "peter@sellers.com": - assertEquals(Visibility.PRIVATE, email.getVisibility()); - assertEquals("APP-5555555555555555", email.retrieveSourcePath()); - assertEquals(false, email.isVerified()); - assertEquals(true, email.isPrimary()); - break; - default: - fail("Invalid email: " + email.getEmail()); - } - } - } + assertEquals(1, emails.getEmails().size()); + Email email = emails.getEmails().get(0); + Utils.verifyLastModified(email.getLastModifiedDate()); + assertEquals(email.getEmail(), "teddybass3private@semantico.com"); + assertEquals(Visibility.PRIVATE, email.getVisibility()); + assertEquals("APP-5555555555555555", email.retrieveSourcePath()); + assertEquals(true, email.isVerified()); + assertEquals(false, email.isPrimary()); } } diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java index 10ffee9214b..0a5bd4d75da 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java @@ -17,7 +17,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.orcid.core.exception.OrcidUnauthorizedException; -import org.orcid.core.togglz.Features; import org.orcid.core.utils.SecurityContextTestUtils; import org.orcid.jaxb.model.common_v2.Visibility; import org.orcid.jaxb.model.groupid_v2.GroupIdRecord; @@ -515,58 +514,28 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Person() { Emails email = p.getEmails(); assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - assertEquals(4, email.getEmails().size()); - - boolean found1 = false, found2 = false, found3 = false, found4 = false; - - for (Email element : email.getEmails()) { - if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { - found1 = true; - } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { - found2 = true; - } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { - found3 = true; - } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { - found4 = true; - } else { - fail("Invalid email " + element.getEmail()); - } - } - - assertTrue(found1); - assertTrue(found2); - assertTrue(found3); - assertTrue(found4); - } else { - assertEquals(5, email.getEmails().size()); - - boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; - - for (Email element : email.getEmails()) { - if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { - found1 = true; - } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { - found2 = true; - } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { - found3 = true; - } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { - found4 = true; - } else if (element.getEmail().equals("self_private_0000-0000-0000-0003@test.orcid.org")) { - found5 = true; - } else { - fail("Invalid email " + element.getEmail()); - } + assertEquals(4, email.getEmails().size()); + + boolean found1 = false, found2 = false, found3 = false, found4 = false; + + for (Email element : email.getEmails()) { + if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { + found1 = true; + } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { + found2 = true; + } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { + found3 = true; + } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { + found4 = true; + } else { + fail("Invalid email " + element.getEmail()); } - - assertTrue(found1); - assertTrue(found2); - assertTrue(found3); - assertTrue(found4); - assertTrue(found5); } + assertTrue(found1); + assertTrue(found2); + assertTrue(found3); + assertTrue(found4); this.assertAllPublicButEmails(p); } diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java index a188cc5fe4e..5f42ab91375 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.orcid.core.exception.OrcidUnauthorizedException; -import org.orcid.core.togglz.Features; import org.orcid.core.utils.SecurityContextTestUtils; import org.orcid.jaxb.model.common_v2.Iso3166Country; import org.orcid.jaxb.model.common_v2.Locale; @@ -1004,59 +1003,30 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Record() { assertNotNull(p.getEmails()); Emails email = p.getEmails(); assertNotNull(email); - Utils.verifyLastModified(email.getLastModifiedDate()); - - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - assertEquals(4, email.getEmails().size()); - - boolean found1 = false, found2 = false, found3 = false, found4 = false; - - for (Email element : email.getEmails()) { - if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { - found1 = true; - } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { - found2 = true; - } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { - found3 = true; - } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { - found4 = true; - } else { - fail("Invalid email " + element.getEmail()); - } - } - - assertTrue(found1); - assertTrue(found2); - assertTrue(found3); - assertTrue(found4); - } else { - assertEquals(5, email.getEmails().size()); - - boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; - - for (Email element : email.getEmails()) { - if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { - found1 = true; - } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { - found2 = true; - } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { - found3 = true; - } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { - found4 = true; - } else if (element.getEmail().equals("self_private_0000-0000-0000-0003@test.orcid.org")) { - found5 = true; - } else { - fail("Invalid email " + element.getEmail()); - } + Utils.verifyLastModified(email.getLastModifiedDate()); + assertEquals(4, email.getEmails().size()); + + boolean found1 = false, found2 = false, found3 = false, found4 = false; + + for (Email element : email.getEmails()) { + if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { + found1 = true; + } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { + found2 = true; + } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { + found3 = true; + } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { + found4 = true; + } else { + fail("Invalid email " + element.getEmail()); } - - assertTrue(found1); - assertTrue(found2); - assertTrue(found3); - assertTrue(found4); - assertTrue(found5); } + assertTrue(found1); + assertTrue(found2); + assertTrue(found3); + assertTrue(found4); + this.assertAllPublicButEmails(p); } diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_EmailsTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_EmailsTest.java index f8841c21c28..bff3f1a21a6 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_EmailsTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_EmailsTest.java @@ -150,50 +150,12 @@ public void testViewEmails() { assertEquals("/4444-4444-4444-4443/email", emails.getPath()); Utils.verifyLastModified(emails.getLastModifiedDate()); assertNotNull(emails.getEmails()); - - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - assertEquals(1, emails.getEmails().size()); - Email email = emails.getEmails().get(0); - assertEquals("teddybass3private@semantico.com", email.getEmail()); - assertEquals(Visibility.PRIVATE, email.getVisibility()); - assertEquals("APP-5555555555555555", email.retrieveSourcePath()); - assertEquals(true, email.isVerified()); - assertEquals(false, email.isPrimary()); - } else { - assertEquals(3, emails.getEmails().size()); - for (Email email : emails.getEmails()) { - Utils.verifyLastModified(email.getLastModifiedDate()); - assertThat(email.getEmail(), anyOf(is("teddybass2@semantico.com"), is("teddybass3public@semantico.com"), is("teddybass3private@semantico.com"))); - switch (email.getEmail()) { - case "teddybass2@semantico.com": - assertEquals(Visibility.LIMITED, email.getVisibility()); - assertEquals("4444-4444-4444-4443", email.retrieveSourcePath()); - assertEquals(false, email.isVerified()); - assertEquals(false, email.isPrimary()); - break; - case "teddybass3public@semantico.com": - assertEquals(Visibility.PUBLIC, email.getVisibility()); - assertEquals("4444-4444-4444-4443", email.retrieveSourcePath()); - assertEquals(false, email.isVerified()); - assertEquals(false, email.isPrimary()); - break; - case "teddybass3private@semantico.com": - assertEquals(Visibility.PRIVATE, email.getVisibility()); - assertEquals("APP-5555555555555555", email.retrieveSourcePath()); - assertEquals(true, email.isVerified()); - assertEquals(false, email.isPrimary()); - break; - case "peter@sellers.com": - assertEquals(Visibility.PRIVATE, email.getVisibility()); - assertEquals("APP-5555555555555555", email.retrieveSourcePath()); - assertEquals(false, email.isVerified()); - assertEquals(true, email.isPrimary()); - break; - default: - fail("Invalid email: " + email.getEmail()); - break; - } - } - } + assertEquals(1, emails.getEmails().size()); + Email email = emails.getEmails().get(0); + assertEquals("teddybass3private@semantico.com", email.getEmail()); + assertEquals(Visibility.PRIVATE, email.getVisibility()); + assertEquals("APP-5555555555555555", email.retrieveSourcePath()); + assertEquals(true, email.isVerified()); + assertEquals(false, email.isPrimary()); } } diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java index 982a3b7bf78..ed43bc74c25 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java @@ -17,7 +17,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.orcid.core.exception.OrcidUnauthorizedException; -import org.orcid.core.togglz.Features; import org.orcid.core.utils.SecurityContextTestUtils; import org.orcid.jaxb.model.groupid_v2.GroupIdRecord; import org.orcid.jaxb.model.message.ScopePathType; @@ -521,58 +520,30 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Person() { Emails email = p.getEmails(); assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - assertEquals(4, email.getEmails().size()); - - boolean found1 = false, found2 = false, found3 = false, found4 = false; - - for (Email element : email.getEmails()) { - if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { - found1 = true; - } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { - found2 = true; - } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { - found3 = true; - } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { - found4 = true; - } else { - fail("Invalid email " + element.getEmail()); - } - } - - assertTrue(found1); - assertTrue(found2); - assertTrue(found3); - assertTrue(found4); - } else { - assertEquals(4, email.getEmails().size()); - - boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; - - for (Email element : email.getEmails()) { - if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { - found1 = true; - } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { - found2 = true; - } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { - found3 = true; - } else if (element.getEmail().equals("self_private_0000-0000-0000-0003@test.orcid.org")) { - found5 = true; - } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { - found4 = true; - } else { - fail("Invalid email " + element.getEmail()); - } + + assertEquals(4, email.getEmails().size()); + + boolean found1 = false, found2 = false, found3 = false, found4 = false; + + for (Email element : email.getEmails()) { + if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { + found1 = true; + } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { + found2 = true; + } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { + found3 = true; + } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { + found4 = true; + } else { + fail("Invalid email " + element.getEmail()); } - - assertTrue(found1); - assertTrue(found2); - assertTrue(found3); - assertTrue(found4); - assertTrue(found5); } - + + assertTrue(found1); + assertTrue(found2); + assertTrue(found3); + assertTrue(found4); + this.assertAllPublicButEmails(p); } diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java index ca2c7d55282..65c5508cc1e 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.orcid.core.exception.OrcidUnauthorizedException; -import org.orcid.core.togglz.Features; import org.orcid.core.utils.SecurityContextTestUtils; import org.orcid.jaxb.model.common.AvailableLocales; import org.orcid.jaxb.model.common.FundingType; @@ -1212,57 +1211,28 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Record() { assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - assertEquals(4, email.getEmails().size()); - - boolean found1 = false, found2 = false, found3 = false, found4 = false; - - for (Email element : email.getEmails()) { - if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { - found1 = true; - } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { - found2 = true; - } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { - found3 = true; - } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { - found4 = true; - } else { - fail("Invalid email " + element.getEmail()); - } - } - - assertTrue(found1); - assertTrue(found2); - assertTrue(found3); - assertTrue(found4); - } else { - assertEquals(5, email.getEmails().size()); - - boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; - - for (Email element : email.getEmails()) { - if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { - found1 = true; - } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { - found2 = true; - } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { - found3 = true; - } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { - found4 = true; - } else if (element.getEmail().equals("self_private_0000-0000-0000-0003@test.orcid.org")) { - found5 = true; - } else { - fail("Invalid email " + element.getEmail()); - } + assertEquals(4, email.getEmails().size()); + + boolean found1 = false, found2 = false, found3 = false, found4 = false; + + for (Email element : email.getEmails()) { + if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { + found1 = true; + } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { + found2 = true; + } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { + found3 = true; + } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { + found4 = true; + } else { + fail("Invalid email " + element.getEmail()); } - - assertTrue(found1); - assertTrue(found2); - assertTrue(found3); - assertTrue(found4); - assertTrue(found5); } + assertTrue(found1); + assertTrue(found2); + assertTrue(found3); + assertTrue(found4); this.assertAllPublicButEmails(p); } diff --git a/orcid-core/src/main/java/org/orcid/core/manager/impl/OrcidGenerationManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/impl/OrcidGenerationManagerImpl.java index 2f6b61a8187..abcb572ee20 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/impl/OrcidGenerationManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/impl/OrcidGenerationManagerImpl.java @@ -9,7 +9,6 @@ import org.orcid.core.crypto.OrcidCheckDigitGenerator; import org.orcid.core.manager.OrcidGenerationManager; import org.orcid.core.manager.ProfileEntityManager; -import org.orcid.core.togglz.Features; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,18 +54,13 @@ private boolean isInRecentOrcidCache(String formattedOrcid) { private long getRandomNumber() { Random random = new Random(); - // Is the new range of IDs enabled? - if(Features.ENABLE_NEW_IDS.isActive()) { - long randomLong = (long) (ORCID_BASE_V2_MIN + (random.nextDouble() * ORCID_IDS_V2_RANGE_SIZE)); - // Verify random is between valid range - while(randomLong < ORCID_BASE_V2_MIN || randomLong > ORCID_BASE_V2_MAX) { - randomLong = (long) (ORCID_BASE_V2_MIN + (random.nextDouble() * ORCID_IDS_V2_RANGE_SIZE)); - } - - return randomLong; - } else { - return (long) (ORCID_BASE_MIN + (random.nextDouble() * (ORCID_BASE_MAX - ORCID_BASE_MIN + 1))); - } + long randomLong = (long) (ORCID_BASE_V2_MIN + (random.nextDouble() * ORCID_IDS_V2_RANGE_SIZE)); + // Verify random is between valid range + while(randomLong < ORCID_BASE_V2_MIN || randomLong > ORCID_BASE_V2_MAX) { + randomLong = (long) (ORCID_BASE_V2_MIN + (random.nextDouble() * ORCID_IDS_V2_RANGE_SIZE)); + } + + return randomLong; } private String formatOrcid(String orcid) { diff --git a/orcid-core/src/main/java/org/orcid/core/manager/impl/OrgDisambiguatedManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/impl/OrgDisambiguatedManagerImpl.java index 03faaeb9208..74c078876a9 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/impl/OrgDisambiguatedManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/impl/OrgDisambiguatedManagerImpl.java @@ -19,7 +19,6 @@ import org.orcid.core.orgs.extId.normalizer.OrgDisambiguatedExternalIdNormalizer; import org.orcid.core.orgs.grouping.OrgGrouping; import org.orcid.core.solr.OrcidSolrOrgsClient; -import org.orcid.core.togglz.Features; import org.orcid.persistence.dao.OrgDao; import org.orcid.persistence.dao.OrgDisambiguatedDao; import org.orcid.persistence.dao.OrgDisambiguatedExternalIdentifierDao; @@ -199,8 +198,7 @@ synchronized public void processOrgsWithIncorrectPopularity() { @Override public List searchOrgsFromSolr(String searchTerm, int firstResult, int maxResult, boolean fundersOnly) { - List docs = orcidSolrOrgsClient.getOrgs(searchTerm, firstResult, maxResult, fundersOnly, - Features.ENABLE_PROMOTION_OF_CHOSEN_ORGS.isActive()); + List docs = orcidSolrOrgsClient.getOrgs(searchTerm, firstResult, maxResult, fundersOnly); List ret = new ArrayList(); for (OrgDisambiguatedSolrDocument doc : docs) { OrgDisambiguated org = convertSolrDocument(doc); diff --git a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/EmailManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/EmailManagerReadOnlyImpl.java index 506c9dfef2b..0a4a20b6364 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/EmailManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/EmailManagerReadOnlyImpl.java @@ -108,13 +108,8 @@ public Emails getVerifiedEmails(String orcid) { @Override public Emails getPublicEmails(String orcid) { - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - List entities = emailDao.findPublicEmails(orcid, getLastModified(orcid)); - return toEmails(entities); - } else { - List entities = emailDao.findPublicEmailsIncludeUnverified(orcid); - return toEmails(entities); - } + List entities = emailDao.findPublicEmails(orcid, getLastModified(orcid)); + return toEmails(entities); } private Emails toEmails(List entities) { diff --git a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonDetailsManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonDetailsManagerReadOnlyImpl.java index cb555f4677d..404dd3267bf 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonDetailsManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/read_only/impl/PersonDetailsManagerReadOnlyImpl.java @@ -1,7 +1,6 @@ package org.orcid.core.manager.read_only.impl; import java.util.ArrayList; -import java.util.List; import java.util.stream.Collectors; import org.orcid.core.manager.read_only.AddressManagerReadOnly; @@ -13,23 +12,22 @@ import org.orcid.core.manager.read_only.ProfileKeywordManagerReadOnly; import org.orcid.core.manager.read_only.RecordNameManagerReadOnly; import org.orcid.core.manager.read_only.ResearcherUrlManagerReadOnly; -import org.orcid.core.togglz.Features; import org.orcid.jaxb.model.common_v2.Visibility; -import org.orcid.jaxb.model.record_v2.Addresses; import org.orcid.jaxb.model.record_v2.Address; +import org.orcid.jaxb.model.record_v2.Addresses; import org.orcid.jaxb.model.record_v2.Biography; -import org.orcid.jaxb.model.record_v2.Emails; import org.orcid.jaxb.model.record_v2.Email; -import org.orcid.jaxb.model.record_v2.Keywords; +import org.orcid.jaxb.model.record_v2.Emails; import org.orcid.jaxb.model.record_v2.Keyword; +import org.orcid.jaxb.model.record_v2.Keywords; import org.orcid.jaxb.model.record_v2.Name; -import org.orcid.jaxb.model.record_v2.OtherNames; import org.orcid.jaxb.model.record_v2.OtherName; +import org.orcid.jaxb.model.record_v2.OtherNames; import org.orcid.jaxb.model.record_v2.Person; -import org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers; import org.orcid.jaxb.model.record_v2.PersonExternalIdentifier; -import org.orcid.jaxb.model.record_v2.ResearcherUrls; +import org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers; import org.orcid.jaxb.model.record_v2.ResearcherUrl; +import org.orcid.jaxb.model.record_v2.ResearcherUrls; public class PersonDetailsManagerReadOnlyImpl extends ManagerReadOnlyBaseImpl implements PersonDetailsManagerReadOnly { @@ -125,13 +123,7 @@ public Person getPersonDetails(String orcid) { Emails emails = emailManager.getEmails(orcid); if (emails.getEmails() != null) { Emails filteredEmails = new Emails(); - - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - filteredEmails.setEmails(new ArrayList(emails.getEmails().stream().filter(e -> e.isVerified()).collect(Collectors.toList()))); - } else { - filteredEmails.setEmails(new ArrayList(emails.getEmails())); - } - + filteredEmails.setEmails(new ArrayList(emails.getEmails().stream().filter(e -> e.isVerified()).collect(Collectors.toList()))); person.setEmails(filteredEmails); } return person; diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/GroupingSuggestionManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/GroupingSuggestionManagerReadOnlyImpl.java index 5e864029289..789e9449380 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/GroupingSuggestionManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/GroupingSuggestionManagerReadOnlyImpl.java @@ -6,7 +6,6 @@ import org.orcid.core.manager.v3.GroupingSuggestionsCacheManager; import org.orcid.core.manager.v3.read_only.GroupingSuggestionManagerReadOnly; -import org.orcid.core.togglz.Features; import org.orcid.pojo.grouping.WorkGroupingSuggestion; import org.orcid.pojo.grouping.WorkGroupingSuggestions; import org.orcid.pojo.grouping.WorkGroupingSuggestionsCount; @@ -18,9 +17,6 @@ public class GroupingSuggestionManagerReadOnlyImpl implements GroupingSuggestion @Override public WorkGroupingSuggestions getGroupingSuggestions(String orcid) { - if (!Features.GROUPING_SUGGESTIONS.isActive()) { - return null; - } boolean more = groupingSuggestionsCacheManager.getGroupingSuggestionCount(orcid) > SUGGESTION_BATCH_SIZE; List suggestions = groupingSuggestionsCacheManager.getGroupingSuggestions(orcid, SUGGESTION_BATCH_SIZE); return getWorkGroupingSuggestions(suggestions, more); diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/RecordManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/RecordManagerReadOnlyImpl.java index c01b2539881..c10ca1e3ad0 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/RecordManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/RecordManagerReadOnlyImpl.java @@ -9,7 +9,7 @@ import org.orcid.core.manager.v3.read_only.EmailManagerReadOnly; import org.orcid.core.manager.v3.read_only.PersonDetailsManagerReadOnly; import org.orcid.core.manager.v3.read_only.RecordManagerReadOnly; -import org.orcid.core.togglz.Features; +import org.orcid.core.utils.DateUtils; import org.orcid.core.utils.SourceEntityUtils; import org.orcid.jaxb.model.common.AvailableLocales; import org.orcid.jaxb.model.common.OrcidType; @@ -27,7 +27,6 @@ import org.orcid.jaxb.model.v3.release.record.SubmissionDate; import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.pojo.ajaxForm.PojoUtil; -import org.orcid.core.utils.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -89,7 +88,7 @@ public Record getRecord(String orcid, boolean filterVersionOfIdentifiers) { record.setOrcidIdentifier(getOrcidIdentifier(orcid)); record.setPreferences(getPreferences(orcid)); record.setActivitiesSummary(activitiesSummaryManager.getActivitiesSummary(orcid, filterVersionOfIdentifiers)); - record.setPerson(personDetailsManager.getPersonDetails(orcid, !Features.HIDE_UNVERIFIED_EMAILS.isActive())); + record.setPerson(personDetailsManager.getPersonDetails(orcid, false)); return record; } diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/WorkManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/WorkManagerReadOnlyImpl.java index 482135b1e89..e381fc39b1b 100644 --- a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/WorkManagerReadOnlyImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/WorkManagerReadOnlyImpl.java @@ -309,11 +309,8 @@ public Works groupWorksAndGenerateGroupingSuggestions(List summarie groupGenerator.group(work); } Works works = processGroupedWorks(groupGenerator.getGroups()); - - if (Features.GROUPING_SUGGESTIONS.isActive()) { - List suggestions = groupGenerator.getGroupingSuggestions(orcid); - groupingSuggestionsManager.cacheGroupingSuggestions(orcid, suggestions); - } + List suggestions = groupGenerator.getGroupingSuggestions(orcid); + groupingSuggestionsManager.cacheGroupingSuggestions(orcid, suggestions); return works; } @@ -324,11 +321,8 @@ public WorksExtended groupWorksExtendedAndGenerateGroupingSuggestions(List suggestions = groupGenerator.getGroupingSuggestions(orcid); - groupingSuggestionsManager.cacheGroupingSuggestions(orcid, suggestions); - } + List suggestions = groupGenerator.getGroupingSuggestions(orcid); + groupingSuggestionsManager.cacheGroupingSuggestions(orcid, suggestions); return works; } diff --git a/orcid-core/src/main/java/org/orcid/core/oauth/openid/OpenIDConnectTokenEnhancer.java b/orcid-core/src/main/java/org/orcid/core/oauth/openid/OpenIDConnectTokenEnhancer.java index a2e7fc2c175..2b6e0429add 100644 --- a/orcid-core/src/main/java/org/orcid/core/oauth/openid/OpenIDConnectTokenEnhancer.java +++ b/orcid-core/src/main/java/org/orcid/core/oauth/openid/OpenIDConnectTokenEnhancer.java @@ -106,11 +106,7 @@ public String buildIdToken(OAuth2AccessToken accessToken, String orcid, String c twentyFourHrs.add(Calendar.DAY_OF_YEAR, 1); claims.issueTime(now); - if(Features.ID_TOKEN_24_HOURS_LIFESPAN.isActive()) { - claims.expirationTime(twentyFourHrs.getTime()); - } else { - claims.expirationTime(accessToken.getExpiration()); - } + claims.expirationTime(twentyFourHrs.getTime()); claims.jwtID(UUID.randomUUID().toString()); if (nonce != null) diff --git a/orcid-core/src/main/java/org/orcid/core/oauth/security/OrcidOauthRedirectResolver.java b/orcid-core/src/main/java/org/orcid/core/oauth/security/OrcidOauthRedirectResolver.java index ab6ab152b03..63b4fbcc378 100644 --- a/orcid-core/src/main/java/org/orcid/core/oauth/security/OrcidOauthRedirectResolver.java +++ b/orcid-core/src/main/java/org/orcid/core/oauth/security/OrcidOauthRedirectResolver.java @@ -6,7 +6,6 @@ import java.util.Objects; import java.util.Set; -import org.orcid.core.togglz.Features; import org.springframework.security.oauth2.common.exceptions.InvalidGrantException; import org.springframework.security.oauth2.common.exceptions.InvalidRequestException; import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; @@ -92,10 +91,6 @@ private boolean isEqual(String str1, String str2) { @Override protected boolean hostMatches(String registered, String requested) { - // If we should allow subdomains - if (!Features.DISABLE_MATCHING_SUBDOMAINS.isActive()) { - return isEqual(registered, requested) || (requested != null && requested.endsWith("." + registered)); - } - return isEqual(registered, requested); + return isEqual(registered, requested) || (requested != null && requested.endsWith("." + registered)); } } diff --git a/orcid-core/src/main/java/org/orcid/core/solr/OrcidSolrOrgsClient.java b/orcid-core/src/main/java/org/orcid/core/solr/OrcidSolrOrgsClient.java index be4c57fa21a..b35c09b9262 100644 --- a/orcid-core/src/main/java/org/orcid/core/solr/OrcidSolrOrgsClient.java +++ b/orcid-core/src/main/java/org/orcid/core/solr/OrcidSolrOrgsClient.java @@ -1,6 +1,6 @@ package org.orcid.core.solr; -import static org.orcid.core.solr.SolrConstants.*; +import static org.orcid.core.solr.SolrConstants.ORG_DISAMBIGUATED_ID; import java.io.IOException; import java.text.MessageFormat; @@ -51,11 +51,7 @@ public OrgDisambiguatedSolrDocument findById(Long id) { return null; } - public List getOrgs(String searchTerm, int firstResult, int maxResult, boolean promoteChosenOrgs) { - return getOrgs(searchTerm, firstResult, maxResult, false, promoteChosenOrgs); - } - - public List getOrgs(String searchTerm, int firstResult, int maxResult, boolean fundersOnly, boolean promoteChosenOrgs) { + public List getOrgs(String searchTerm, int firstResult, int maxResult, boolean fundersOnly) { StringBuilder queryString = new StringBuilder(SOLR_ORGS_QUERY.replace("%s", searchTerm)); if (fundersOnly) { queryString.append(" AND is-funding-org:true"); diff --git a/orcid-core/src/main/java/org/orcid/core/togglz/Features.java b/orcid-core/src/main/java/org/orcid/core/togglz/Features.java index c3fceb46f17..ec5978bcc45 100644 --- a/orcid-core/src/main/java/org/orcid/core/togglz/Features.java +++ b/orcid-core/src/main/java/org/orcid/core/togglz/Features.java @@ -21,30 +21,12 @@ public enum Features implements Feature { @Label("Redirect PUT token actions from *.pub.orcid.org to *.orcid.org") REDIRECT_PUT_TOKEN_ENDPOINT, - @Label("New Developer tools") - NEW_DEVELOPER_TOOLS, - @Label("Stop sending notification if work has not been updated") STOP_SENDING_NOTIFICATION_WORK_NOT_UPDATED, - @Label("Move client from a member to another member") - MOVE_CLIENT, - - @Label("Add other people contributions via BIBTEXT") - ADD_OTHER_WORK_CONTRIBUTORS_WITH_BIBTEX, - - @Label("Disable matching subdomains") - DISABLE_MATCHING_SUBDOMAINS, - @Label("Enable Crazy Egg") CRAZY_EGG, - @Label("Add other people contributions via DOI & PUBMED") - ADD_OTHER_WORK_CONTRIBUTORS_WITH_DOI_PUBMED, - - @Label("Add other people contributions manually") - ADD_OTHER_WORK_CONTRIBUTORS, - @Label("Restrict delegator access to account settings") RESTRICTED_DELEGATORS, @@ -56,33 +38,9 @@ public enum Features implements Feature { @Label("Spam button") SPAM_BUTTON, - - @Label("Email status dropdown option") - EMAIL_STATUS_DROPDOWN_OPTION, - - @Label("Enable 2019 header") - ENABLE_HEADER2, - - @Label("Change view privacy from work/funding/affiliation form dialogs") - DIALOG_PRIVACY_OPTION, - + @Label("Shows an alert message when a user goes to /signin and is already signed in\n") RE_LOGGIN_ALERT, - - @Label("Affiliation org ID in UI") - AFFILIATION_ORG_ID, - - @Label("Affiliation search") - AFFILIATION_SEARCH, - - @Label("Https for links to iDs") - HTTPS_IDS, - - @Label("Arabic translation") - LANG_AR, - - @Label("New footer") - NEW_FOOTER, @Label("Reset password send email in all cases") RESET_PASSWORD_EMAIL, @@ -99,45 +57,18 @@ public enum Features implements Feature { @Label("Self service org ids") SELF_SERVICE_ORG_IDS, - @Label("Disable reCAPTCHA") - DISABLE_RECAPTCHA, - - @Label("Check external id resolution in UI") - EX_ID_RESOLVER, - @Label("Remove https://orcid.org from OpenID id_tokens") OPENID_SIMPLE_SUBJECT, - @Label("Enable manual work grouping") - MANUAL_WORK_GROUPING, - - @Label("Grouping suggestions") - GROUPING_SUGGESTIONS, - - @Label("Enable promotion of chosen orgs in search") - ENABLE_PROMOTION_OF_CHOSEN_ORGS, - @Label("Enable the API record create endpoint for QA purposes") ENABLE_RECORD_CREATE_ENDPOINT, - @Label("Hide unverified emails") - HIDE_UNVERIFIED_EMAILS, - @Label("User OBO") USER_OBO, @Label("Works failure debug") WORKS_FAILURE_DEBUG, - @Label("Disable the 2.0 release candidates") - V2_DISABLE_RELEASE_CANDIDATES, - - @Label("Disable the 3.0 release candidates") - V3_DISABLE_RELEASE_CANDIDATES, - - @Label("ID token 24 hours lifespan") - ID_TOKEN_24_HOURS_LIFESPAN, - @Label("Promote a client from public client to be a member") UPGRADE_PUBLIC_CLIENT, @@ -151,10 +82,7 @@ public enum Features implements Feature { ENABLE_ACCOUNT_LOCKOUT, @Label("Do not lock the account on the UI when the lockout threshold is exceeded") - ACCOUNT_LOCKOUT_SIMULATION, - - @Label("Enable the new 100M ID's range") - ENABLE_NEW_IDS, + ACCOUNT_LOCKOUT_SIMULATION, @Label("Send verification emails for 2, 7 and 28 days. If disabled 2 days only verification emails will be sent.") SEND_ALL_VERIFICATION_EMAILS, diff --git a/orcid-core/src/main/java/org/orcid/core/utils/v3/OrcidIdentifierUtils.java b/orcid-core/src/main/java/org/orcid/core/utils/v3/OrcidIdentifierUtils.java index 6794e40f45f..ce9ba0eaae0 100644 --- a/orcid-core/src/main/java/org/orcid/core/utils/v3/OrcidIdentifierUtils.java +++ b/orcid-core/src/main/java/org/orcid/core/utils/v3/OrcidIdentifierUtils.java @@ -3,7 +3,6 @@ import java.net.URI; import java.net.URISyntaxException; -import org.orcid.core.togglz.Features; import org.orcid.jaxb.model.v3.release.common.OrcidIdentifier; import org.springframework.beans.factory.annotation.Value; @@ -14,10 +13,7 @@ public class OrcidIdentifierUtils { public OrcidIdentifier buildOrcidIdentifier(String orcid) { OrcidIdentifier identifier = new OrcidIdentifier(); - String correctedBaseUri = baseUri; - if(!Features.HTTPS_IDS.isActive()) { - correctedBaseUri = correctedBaseUri.replace("https", "http"); - } + String correctedBaseUri = baseUri; try { URI uri = new URI(correctedBaseUri); identifier.setHost(uri.getHost()); diff --git a/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/DOIResolver.java b/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/DOIResolver.java index 1af19fa48ab..353c283d1a8 100644 --- a/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/DOIResolver.java +++ b/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/DOIResolver.java @@ -20,7 +20,7 @@ import org.orcid.core.exception.UnexpectedResponseCodeException; import org.orcid.core.locale.LocaleManager; import org.orcid.core.manager.IdentifierTypeManager; -import org.orcid.core.togglz.Features; +import org.orcid.core.utils.OrcidStringUtils; import org.orcid.core.utils.v3.identifiers.PIDNormalizationService; import org.orcid.core.utils.v3.identifiers.PIDResolverCache; import org.orcid.core.utils.v3.identifiers.normalizers.DOINormalizer; @@ -41,14 +41,12 @@ import org.orcid.jaxb.model.v3.release.record.Citation; import org.orcid.jaxb.model.v3.release.record.ExternalID; import org.orcid.jaxb.model.v3.release.record.ExternalIDs; -import org.orcid.jaxb.model.v3.release.record.Work; import org.orcid.jaxb.model.v3.release.record.WorkTitle; import org.orcid.pojo.ContributorsRolesAndSequences; import org.orcid.pojo.IdentifierType; import org.orcid.pojo.PIDResolutionResult; import org.orcid.pojo.WorkExtended; import org.orcid.pojo.ajaxForm.PojoUtil; -import org.orcid.core.utils.OrcidStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -345,7 +343,7 @@ private WorkExtended getWorkExtended(JSONObject json) throws JSONException { } catch (JSONException ignored) { } } - if (json.has("author") && Features.ADD_OTHER_WORK_CONTRIBUTORS_WITH_DOI_PUBMED.isActive() ) { + if (json.has("author")) { List contributorsGroupedByOrcid = new ArrayList<>(); try { JSONArray contributors = json.getJSONArray("author"); diff --git a/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/PubMedResolver.java b/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/PubMedResolver.java index b7dfdbb567a..eafbddb123d 100644 --- a/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/PubMedResolver.java +++ b/orcid-core/src/main/java/org/orcid/core/utils/v3/identifiers/resolvers/PubMedResolver.java @@ -24,11 +24,9 @@ import org.orcid.core.exception.UnexpectedResponseCodeException; import org.orcid.core.locale.LocaleManager; import org.orcid.core.manager.IdentifierTypeManager; -import org.orcid.core.togglz.Features; import org.orcid.core.utils.v3.identifiers.PIDNormalizationService; import org.orcid.core.utils.v3.identifiers.PIDResolverCache; import org.orcid.jaxb.model.common.Relationship; -import org.orcid.jaxb.model.common.SequenceType; import org.orcid.jaxb.model.common.WorkType; import org.orcid.jaxb.model.v3.release.common.ContributorAttributes; import org.orcid.jaxb.model.v3.release.common.ContributorOrcid; @@ -242,7 +240,7 @@ private WorkExtended getWork(JSONObject json) throws JSONException, ParseExcepti addExternalIdentifier(work, "doi", workMetadata.getString("doi"), locale); } - if (workMetadata.has("authorList") && Features.ADD_OTHER_WORK_CONTRIBUTORS_WITH_DOI_PUBMED.isActive()) { + if (workMetadata.has("authorList")) { List contributorsGroupedByOrcid = new ArrayList<>(); JSONObject authorList = workMetadata.getJSONObject("authorList"); JSONArray contributors = authorList.getJSONArray("author"); diff --git a/orcid-core/src/test/java/org/orcid/core/manager/OrcidGenerationManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/OrcidGenerationManagerTest.java index 864c1f66ed5..b8ece29b573 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/OrcidGenerationManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/OrcidGenerationManagerTest.java @@ -31,31 +31,8 @@ public class OrcidGenerationManagerTest extends BaseTest { private static final Logger logger = Logger.getLogger(OrcidGenerationManagerTest.class); - @Test - public void testCreateNewOrcidV1() { - togglzRule.disable(Features.ENABLE_NEW_IDS); - Set orcids = new HashSet(); - for (int i = 0; i < 20000; i++) { - String orcid = orcidGenerationManager.createNewOrcid(); - - assertNotNull("ORCID is null", orcid); - assertTrue("ORCID is in wrong format " + orcid, orcid.matches("(\\d{4}-){3}\\d{3}[\\dX]")); - assertTrue("ORCID has invalid check character " + orcid, OrcidCheckDigitGenerator.validate(orcid)); - assertFalse("ORCID has already been used " + orcid + " number of elements cached: " + orcids.size(), orcids.contains(orcid)); - - String baseDigits = orcid.substring(0, orcid.length() - 1).replace("-", ""); - long numericOrcid = Long.valueOf(baseDigits); - assertTrue("Numeric value of ORCID is too low " + orcid, numericOrcid >= OrcidGenerationManager.ORCID_BASE_MIN); - assertTrue("Numeric value of ORCID is too high " + orcid, numericOrcid <= OrcidGenerationManager.ORCID_BASE_MAX); - - orcids.add(orcid); - logger.info("Got ORCID = " + orcid); - } - } - @Test public void testCreateNewOrcidV2() { - togglzRule.enable(Features.ENABLE_NEW_IDS); Set orcids = new HashSet(); for (int i = 0; i < 1000000; i++) { String orcid = orcidGenerationManager.createNewOrcid(); diff --git a/orcid-core/src/test/java/org/orcid/core/manager/v3/PersonDetailsManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/v3/PersonDetailsManagerTest.java index 2b369b20501..9636e3397ba 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/v3/PersonDetailsManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/v3/PersonDetailsManagerTest.java @@ -47,7 +47,7 @@ public static void removeDBUnitData() throws Exception { @Test public void testGetPersonDetails() { - Person person = personDetailsManager.getPersonDetails(ORCID, !Features.HIDE_UNVERIFIED_EMAILS.isActive()); + Person person = personDetailsManager.getPersonDetails(ORCID, false); assertNotNull(person); assertNotNull(person.getExternalIdentifiers()); @@ -72,16 +72,11 @@ public void testGetPersonDetails() { assertNotNull(person.getEmails()); assertNotNull(person.getEmails().getEmails()); - - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - assertEquals(4, person.getEmails().getEmails().size()); - - for (Email email : person.getEmails().getEmails()) { - assertTrue(email.isVerified()); - } - } else { - assertEquals(5, person.getEmails().getEmails().size()); - } + assertEquals(4, person.getEmails().getEmails().size()); + + for (Email email : person.getEmails().getEmails()) { + assertTrue(email.isVerified()); + } assertNotNull(person.getBiography()); assertEquals(Visibility.PUBLIC, person.getBiography().getVisibility()); diff --git a/orcid-core/src/test/java/org/orcid/core/manager/v3/RecordManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/v3/RecordManagerTest.java index 527478472bb..05a7b8e07e2 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/v3/RecordManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/v3/RecordManagerTest.java @@ -13,7 +13,6 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.orcid.core.togglz.Features; import org.orcid.jaxb.model.v3.release.common.Visibility; import org.orcid.jaxb.model.v3.release.record.Person; import org.orcid.jaxb.model.v3.release.record.Record; @@ -77,11 +76,7 @@ public void testGetRecord() { assertNotNull(person.getEmails()); assertNotNull(person.getEmails().getEmails()); - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - assertEquals(4, person.getEmails().getEmails().size()); - } else { - assertEquals(5, person.getEmails().getEmails().size()); - } + assertEquals(4, person.getEmails().getEmails().size()); assertNotNull(person.getBiography()); assertEquals(Visibility.PUBLIC, person.getBiography().getVisibility()); diff --git a/orcid-core/src/test/java/org/orcid/core/oauth/security/OrcidOauthRedirectResolverTest.java b/orcid-core/src/test/java/org/orcid/core/oauth/security/OrcidOauthRedirectResolverTest.java index d82d77e0524..d11533c2b9b 100644 --- a/orcid-core/src/test/java/org/orcid/core/oauth/security/OrcidOauthRedirectResolverTest.java +++ b/orcid-core/src/test/java/org/orcid/core/oauth/security/OrcidOauthRedirectResolverTest.java @@ -161,17 +161,10 @@ public void resolveRedirectTest() { @Test public void redirectUriGeneralTests() { - redirectUriGeneralTest(true); - redirectUriGeneralTest(false); + redirectUriGeneralTest(); } - private void redirectUriGeneralTest(Boolean togglzEnabled) { - if(togglzEnabled) { - togglzRule.enable(Features.DISABLE_MATCHING_SUBDOMAINS); - } else { - togglzRule.disable(Features.DISABLE_MATCHING_SUBDOMAINS); - } - + private void redirectUriGeneralTest() { // No matches at all assertFalse(resolver.redirectMatches("https://example.com", "https://qa.orcid.org")); assertFalse(resolver.redirectMatches("https://qa.orcid.org", "https://example.com")); @@ -225,9 +218,6 @@ private void redirectUriGeneralTest(Boolean togglzEnabled) { @Test public void redirectMatches_AllowMatchingSubdomainsTest() { - // Allow matching subdomains - togglzRule.disable(Features.DISABLE_MATCHING_SUBDOMAINS); - // Temp: Subdomain should match if the togglz is OFF assertTrue(resolver.redirectMatches("https://www.orcid.org", "https://orcid.org")); assertTrue(resolver.redirectMatches("https://qa.orcid.org", "https://orcid.org")); @@ -238,18 +228,4 @@ public void redirectMatches_AllowMatchingSubdomainsTest() { assertTrue(resolver.redirectMatches("https://www.example.com", "https://example.com")); } - @Test - public void redirectMatches_RejectMatchingSubdomainsTest() { - // Reject matching subdomains - togglzRule.enable(Features.DISABLE_MATCHING_SUBDOMAINS); - - // Subdomain should not match if togglz is ON - assertFalse(resolver.redirectMatches("https://www.orcid.org", "https://orcid.org")); - assertFalse(resolver.redirectMatches("https://qa.orcid.org", "https://orcid.org")); - - // Acceptance criteria checks: subdomains should be rejected - assertFalse(resolver.redirectMatches("https://subdomain.example.com/", "https://example.com")); - assertFalse(resolver.redirectMatches("https://subdomain.example.com/subdirectory", "https://example.com")); - assertFalse(resolver.redirectMatches("https://www.example.com", "https://example.com")); - } } diff --git a/orcid-core/src/test/java/org/orcid/core/utils/DOIResolverTest.java b/orcid-core/src/test/java/org/orcid/core/utils/DOIResolverTest.java index a6ea593d76a..f98601a16b6 100644 --- a/orcid-core/src/test/java/org/orcid/core/utils/DOIResolverTest.java +++ b/orcid-core/src/test/java/org/orcid/core/utils/DOIResolverTest.java @@ -2,8 +2,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; @@ -14,6 +14,7 @@ import java.util.Locale; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; @@ -22,6 +23,7 @@ import org.mockito.stubbing.Answer; import org.orcid.core.locale.LocaleManager; import org.orcid.core.manager.IdentifierTypeManager; +import org.orcid.core.togglz.Features; import org.orcid.core.utils.v3.identifiers.PIDNormalizationService; import org.orcid.core.utils.v3.identifiers.PIDResolverCache; import org.orcid.core.utils.v3.identifiers.resolvers.DOIResolver; @@ -34,9 +36,7 @@ import org.orcid.pojo.WorkExtended; import org.orcid.test.TargetProxyHelper; import org.springframework.test.util.ReflectionTestUtils; -import org.orcid.core.togglz.Features; import org.togglz.junit.TogglzRule; -import org.junit.Rule; @@ -195,7 +195,6 @@ public InputStream answer(InvocationOnMock invocation) throws Throwable { }); - togglzRule.enable(Features.ADD_OTHER_WORK_CONTRIBUTORS_WITH_DOI_PUBMED); when(cache.get(eq("https://doi.org/10.000/0000.0004"), any(HashMap.class))).thenAnswer(new Answer() { @Override diff --git a/orcid-core/src/test/java/org/orcid/core/utils/PubMedResolverTest.java b/orcid-core/src/test/java/org/orcid/core/utils/PubMedResolverTest.java index 28850776d09..b26c961a2d3 100644 --- a/orcid-core/src/test/java/org/orcid/core/utils/PubMedResolverTest.java +++ b/orcid-core/src/test/java/org/orcid/core/utils/PubMedResolverTest.java @@ -14,6 +14,7 @@ import javax.ws.rs.core.MediaType; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; @@ -22,6 +23,7 @@ import org.mockito.stubbing.Answer; import org.orcid.core.locale.LocaleManager; import org.orcid.core.manager.IdentifierTypeManager; +import org.orcid.core.togglz.Features; import org.orcid.core.utils.v3.identifiers.PIDNormalizationService; import org.orcid.core.utils.v3.identifiers.PIDResolverCache; import org.orcid.core.utils.v3.identifiers.resolvers.PubMedResolver; @@ -34,8 +36,6 @@ import org.orcid.test.TargetProxyHelper; import org.springframework.test.util.ReflectionTestUtils; import org.togglz.junit.TogglzRule; -import org.junit.Rule; -import org.orcid.core.togglz.Features; public class PubMedResolverTest { @@ -226,7 +226,6 @@ public void resolvePMIDMetadataTest() { @Test public void resolvePMIDMetadataContributorsTest() { - togglzRule.enable(Features.ADD_OTHER_WORK_CONTRIBUTORS_WITH_DOI_PUBMED); WorkExtended work = resolver.resolveMetadata("pmid", "pmid1"); List contributors = work.getContributorsGroupedByOrcid(); assertNotNull(work); diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/AdminController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/AdminController.java index 2badc25731a..989c9a90445 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/AdminController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/AdminController.java @@ -1061,7 +1061,7 @@ private String getOrcidFromParam(String orcidOrEmail) { @RequestMapping(value = "/validate-client-conversion.json", method = RequestMethod.POST) public @ResponseBody ConvertClient validateClientConversion(HttpServletRequest serverRequest, HttpServletResponse response, @RequestBody ConvertClient data) throws IllegalAccessException { - if (!Features.UPGRADE_PUBLIC_CLIENT.isActive() && !Features.MOVE_CLIENT.isActive()) { + if (!Features.UPGRADE_PUBLIC_CLIENT.isActive()) { throw new IllegalAccessException("Feature UPGRADE_PUBLIC_CLIENT is disabled"); } data.setGroupIdNotFound(false); @@ -1145,9 +1145,6 @@ private String getOrcidFromParam(String orcidOrEmail) { @RequestMapping(value = "/move-client.json", method = RequestMethod.POST) public @ResponseBody ConvertClient moveClient(HttpServletRequest serverRequest, HttpServletResponse response, @RequestBody ConvertClient data) throws IllegalAccessException { - if (!Features.MOVE_CLIENT.isActive()) { - throw new IllegalAccessException("Feature UPGRADE_PUBLIC_CLIENT is disabled"); - } isAdmin(serverRequest, response); data = validateClientConversion(serverRequest, response, data); if (data.isClientNotFound() || !data.isAlreadyMember() || data.isGroupIdNotFound() || data.isClientDeactivated()) { diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/BaseController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/BaseController.java index 396f12e5b5a..9f4de5863c2 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/BaseController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/BaseController.java @@ -918,11 +918,7 @@ protected String getCurrentUserOrcid() { publicEmails = emailManagerReadOnly.getEmails(orcid); } Emails filteredEmails = new Emails(); - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - filteredEmails.setEmails(new ArrayList(publicEmails.getEmails().stream().filter(e -> e.isVerified()).collect(Collectors.toList()))); - } else { - filteredEmails.setEmails(new ArrayList(publicEmails.getEmails())); - } + filteredEmails.setEmails(new ArrayList(publicEmails.getEmails().stream().filter(e -> e.isVerified()).collect(Collectors.toList()))); Map> groupedEmails = groupEmails(filteredEmails); publicRecordPersonDetails.setPublicGroupedEmails(groupedEmails); diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/HomeController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/HomeController.java index 8f775ec968d..9ecb15454cb 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/HomeController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/HomeController.java @@ -287,12 +287,7 @@ public String getMaintenanceMessage() { } protected String getSearchBaseUrl() { - String pubBaseUri = orcidUrlManager.getPubBaseUrl(); - if(Features.HTTPS_IDS.isActive()) { - return pubBaseUri + "/v3.0/search/"; - } else { - return pubBaseUri + "/v1.2/search/orcid-bio/"; - } + return orcidUrlManager.getPubBaseUrl() + "/v3.0/search/"; } class ConfigDetails { diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java index b4f8ab05aa4..8ff400efbe6 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/PublicRecordController.java @@ -1,5 +1,21 @@ package org.orcid.frontend.web.controllers; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.GregorianCalendar; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.annotation.Resource; +import javax.xml.datatype.XMLGregorianCalendar; + import org.orcid.core.common.manager.EventManager; import org.orcid.core.exception.DeactivatedException; import org.orcid.core.exception.LockedException; @@ -42,12 +58,9 @@ import org.orcid.jaxb.model.v3.release.record.Emails; import org.orcid.jaxb.model.v3.release.record.Keywords; import org.orcid.jaxb.model.v3.release.record.Name; -import org.orcid.jaxb.model.v3.release.record.OtherName; import org.orcid.jaxb.model.v3.release.record.OtherNames; -import org.orcid.jaxb.model.v3.release.record.Person; import org.orcid.jaxb.model.v3.release.record.PersonExternalIdentifiers; import org.orcid.jaxb.model.v3.release.record.PersonalDetails; -import org.orcid.jaxb.model.v3.release.record.Record; import org.orcid.jaxb.model.v3.release.record.ResearcherUrls; import org.orcid.persistence.jpa.entities.ProfileEntity; import org.orcid.pojo.PeerReviewMinimizedSummary; @@ -75,21 +88,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; -import javax.xml.datatype.XMLGregorianCalendar; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.GregorianCalendar; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; -import java.util.stream.Stream; - @Controller public class PublicRecordController extends BaseWorkspaceController { @@ -294,12 +292,8 @@ PublicRecord getRecord(String orcid) { publicEmails = emailManagerReadOnly.getPublicEmails(orcid); Emails filteredEmails = new Emails(); - if (Features.HIDE_UNVERIFIED_EMAILS.isActive()) { - filteredEmails.setEmails(new ArrayList<>(publicEmails.getEmails().stream().filter(Email::isVerified).collect(Collectors.toList()))); - } else { - filteredEmails.setEmails(new ArrayList<>(publicEmails.getEmails())); - } - + filteredEmails.setEmails(new ArrayList<>(publicEmails.getEmails().stream().filter(Email::isVerified).collect(Collectors.toList()))); + publicRecord.setEmails(org.orcid.pojo.ajaxForm.Emails.valueOf(filteredEmails)); // Fill external identifiers diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/RegistrationController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/RegistrationController.java index a3e86e1fce9..56b8006d90a 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/RegistrationController.java +++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/RegistrationController.java @@ -516,18 +516,7 @@ public ModelAndView verifyEmail(HttpServletRequest request, HttpServletResponse } return new ModelAndView(redirect); - } - - private Search findPotentialDuplicatesByFirstNameLastName(String firstName, String lastName) { - LOGGER.debug("About to search for potential duplicates during registration for first name={}, last name={}", firstName, lastName); - SearchOrcidSolrCriteria queryForm = new SearchOrcidSolrCriteria(); - queryForm.setGivenName(firstName); - queryForm.setFamilyName(lastName); - Search visibleProfiles = orcidSearchManager.findOrcidsByQuery(queryForm.deriveQueryString(), DUP_SEARCH_START, DUP_SEARCH_ROWS); - LOGGER.debug("Found {} potential duplicates during registration for first name={}, last name={}", - new Object[] { visibleProfiles.getNumFound(), firstName, lastName }); - return visibleProfiles; - } + } private void createMinimalRegistrationAndLogUserIn(HttpServletRequest request, HttpServletResponse response, Registration registration, boolean usedCaptchaVerification, Locale locale, String ip) {