From 4fbc5eb2a52681d522890d7acece78fde5afb583 Mon Sep 17 00:00:00 2001 From: Angel Montenegro Date: Thu, 4 Apr 2024 15:25:29 -0600 Subject: [PATCH 1/8] Improve validated activities count (#7020) * Deactivated records should get 409 on GET requests * When looking into a group, if any element inside the group is validated count the group as validated * Working on unit tests * Working on unit tests * Working on unit tests * Still working on moving functionality to the orcid-core package * Still working on moving functionality to the orcid-core package * Still working on moving functionality to the orcid-core package * Still working on unit tests * Happy path unit tests done * Fixing unit tests * Adding more unit tests * ImproveValidatedActivitiesCount * New endpoint in mapi * Very basic XML --- .../org/orcid/pojo/summary/AffiliationSummary.java | 14 +++++++------- .../java/org/orcid/pojo/summary/RecordSummary.java | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java b/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java index 03ee2c4eae6..6a7bad05497 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java +++ b/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java @@ -6,13 +6,13 @@ import org.orcid.pojo.ajaxForm.PojoUtil; public class AffiliationSummary { - public String organizationName; - public String url; - public String startDate; - public String endDate; - public String role; - public String type; - public boolean validated; + private String organizationName; + private String url; + private String startDate; + private String endDate; + private String role; + private String type; + private boolean validated; public String getOrganizationName() { return organizationName; diff --git a/orcid-core/src/main/java/org/orcid/pojo/summary/RecordSummary.java b/orcid-core/src/main/java/org/orcid/pojo/summary/RecordSummary.java index 6f9a20ec1d6..1c3cfed92fd 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/summary/RecordSummary.java +++ b/orcid-core/src/main/java/org/orcid/pojo/summary/RecordSummary.java @@ -3,9 +3,12 @@ import java.util.List; +import javax.xml.bind.annotation.XmlRootElement; + import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +@XmlRootElement public class RecordSummary { @JsonInclude(Include.NON_NULL) private String name; From 8466ad1d8431907050b1e04fc2af9f941195bd5a Mon Sep 17 00:00:00 2001 From: github actions Date: Thu, 4 Apr 2024 21:38:39 +0000 Subject: [PATCH 2/8] v2.57.4 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f5f2deb859..c221313bf85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.57.4 - 2024-04-04 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.57.3...v2.57.4) + ## v2.57.3 - 2024-04-04 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.57.2...v2.57.3) From 0b546bc9745a4e1b3380f0cb5ee8d9b67bc51b4d Mon Sep 17 00:00:00 2001 From: Daniel Palafox Date: Thu, 4 Apr 2024 20:02:37 -0600 Subject: [PATCH 3/8] feature: Alter ip column in events to for IPV6 and add event tracking to V2 (#7019) * feature: Alter ip column in events to for IPV6 and add event tracking to V2 * fix: Use public v2 api service delegator inside versionated delegator --------- Co-authored-by: Daniel Palafox --- .../src/main/resources/db-master.xml | 1 + .../db/updates/alter_ip_col_in_events.xml | 33 +++++++++++++++ .../persistence/dao/EventStatsDaoTest.java | 4 +- .../server/PublicV2ApiServiceImplV2_0.java | 40 +++++++++++++++++- .../server/PublicV2ApiServiceImplV2_1.java | 41 ++++++++++++++++++- .../PublicV2ApiServiceDelegator.java | 3 ++ .../impl/PublicV2ApiServiceDelegatorImpl.java | 15 ++++++- ...licV2ApiServiceVersionedDelegatorImpl.java | 13 +++++- 8 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 orcid-persistence/src/main/resources/db/updates/alter_ip_col_in_events.xml diff --git a/orcid-persistence/src/main/resources/db-master.xml b/orcid-persistence/src/main/resources/db-master.xml index fda8f31a661..d629482ead5 100644 --- a/orcid-persistence/src/main/resources/db-master.xml +++ b/orcid-persistence/src/main/resources/db-master.xml @@ -387,4 +387,5 @@ + diff --git a/orcid-persistence/src/main/resources/db/updates/alter_ip_col_in_events.xml b/orcid-persistence/src/main/resources/db/updates/alter_ip_col_in_events.xml new file mode 100644 index 00000000000..052e0d4168f --- /dev/null +++ b/orcid-persistence/src/main/resources/db/updates/alter_ip_col_in_events.xml @@ -0,0 +1,33 @@ + + + + + + + ALTER TABLE event ALTER COLUMN ip VARCHAR(60); + + + + + + + ALTER TABLE event_stats ALTER COLUMN ip VARCHAR(60); + + + + + + + ALTER TABLE event ALTER COLUMN ip TYPE VARCHAR(60); + + + + + + + ALTER TABLE event_stats ALTER COLUMN ip TYPE VARCHAR(60); + + + \ No newline at end of file diff --git a/orcid-persistence/src/test/java/org/orcid/persistence/dao/EventStatsDaoTest.java b/orcid-persistence/src/test/java/org/orcid/persistence/dao/EventStatsDaoTest.java index 42d0b7a76c4..343b6fc8063 100644 --- a/orcid-persistence/src/test/java/org/orcid/persistence/dao/EventStatsDaoTest.java +++ b/orcid-persistence/src/test/java/org/orcid/persistence/dao/EventStatsDaoTest.java @@ -65,7 +65,7 @@ public void createPapiEventStats() { assertEquals(Integer.valueOf(10), eventStatsEntityList.get(1).getCount()); assertNull(eventStatsEntityList.get(2).getClientId()); - assertEquals("104.20.228.70", eventStatsEntityList.get(2).getIp()); + assertEquals("2001:db8:85a3:8d3:1319:8a2e:370:7348", eventStatsEntityList.get(2).getIp()); assertEquals(Integer.valueOf(1100), eventStatsEntityList.get(2).getCount()); @@ -99,7 +99,7 @@ private void createPapiEvents() { for (int i = 0; i < 1100; i++) { EventEntity eventEntity = new EventEntity(); eventEntity.setEventType(EventType.PAPI.getValue()); - eventEntity.setIp("104.20.228.70"); + eventEntity.setIp("2001:db8:85a3:8d3:1319:8a2e:370:7348"); eventEntity.setLabel("anonymous"); LocalDate date = LocalDate.now().minusDays(1); Instant instant = date.atStartOfDay(ZoneId.systemDefault()).toInstant(); diff --git a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_0.java b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_0.java index 20e208195bd..745509da5c3 100644 --- a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_0.java +++ b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_0.java @@ -82,6 +82,9 @@ public class PublicV2ApiServiceImplV2_0 { @Resource protected SwaggerUIBuilder swaggerUIBuilder; + @Context + private HttpServletRequest httpRequest; + public void setServiceDelegator( PublicV2ApiServiceDelegator serviceDelegator) { this.serviceDelegator = serviceDelegator; @@ -110,6 +113,7 @@ public Response viewStatusText() { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ACTIVITIES) public Response viewActivities(@PathParam("orcid") String orcid, @Context HttpServletRequest httpRequest) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewActivities(orcid); } @@ -118,6 +122,7 @@ public Response viewActivities(@PathParam("orcid") String orcid, @Context HttpSe OrcidApiConstants.APPLICATION_CITEPROC }) @Path(WORK + PUTCODE) public Response viewWork(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode, @Context HttpServletRequest httpRequest) { + serviceDelegator.trackEvents(httpRequest); if (OrcidApiConstants.APPLICATION_CITEPROC.equals(httpRequest.getHeader("Accept"))) return serviceDelegator.viewWorkCitation(orcid, putCode); return serviceDelegator.viewWork(orcid, putCode); @@ -127,6 +132,7 @@ public Response viewWork(@PathParam("orcid") String orcid, @PathParam("putCode") @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(WORK_SUMMARY + PUTCODE) public Response viewWorkSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewWorkSummary(orcid, putCode); } @@ -134,6 +140,7 @@ public Response viewWorkSummary(@PathParam("orcid") String orcid, @PathParam("pu @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(WORKS) public Response viewWorks(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewWorks(orcid); } @@ -141,6 +148,7 @@ public Response viewWorks(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(BULK_WORKS) public Response viewSpecifiedWorks(@PathParam("orcid") String orcid, @PathParam("putCodes") String putCodes) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewBulkWorks(orcid, putCodes); } @@ -148,6 +156,7 @@ public Response viewSpecifiedWorks(@PathParam("orcid") String orcid, @PathParam( @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDING + PUTCODE) public Response viewFunding(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFunding(orcid, putCode); } @@ -155,13 +164,15 @@ public Response viewFunding(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDING_SUMMARY + PUTCODE) public Response viewFundingSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFundingSummary(orcid, putCode); } @GET @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDINGS) - public Response viewFundings(@PathParam("orcid") String orcid) { + public Response viewFundings(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFundings(orcid); } @@ -169,6 +180,7 @@ public Response viewFundings(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATION + PUTCODE) public Response viewEducation(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducation(orcid, putCode); } @@ -176,6 +188,7 @@ public Response viewEducation(@PathParam("orcid") String orcid, @PathParam("putC @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATION_SUMMARY + PUTCODE) public Response viewEducationSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducationSummary(orcid, putCode); } @@ -183,6 +196,7 @@ public Response viewEducationSummary(@PathParam("orcid") String orcid, @PathPara @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATIONS) public Response viewEducations(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducations(orcid); } @@ -190,6 +204,7 @@ public Response viewEducations(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENT + PUTCODE) public Response viewEmployment(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmployment(orcid, putCode); } @@ -197,6 +212,7 @@ public Response viewEmployment(@PathParam("orcid") String orcid, @PathParam("put @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENT_SUMMARY + PUTCODE) public Response viewEmploymentSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmploymentSummary(orcid, putCode); } @@ -204,6 +220,7 @@ public Response viewEmploymentSummary(@PathParam("orcid") String orcid, @PathPar @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENTS) public Response viewEmployments(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmployments(orcid); } @@ -211,6 +228,7 @@ public Response viewEmployments(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEW + PUTCODE) public Response viewPeerReview(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReview(orcid, putCode); } @@ -218,6 +236,7 @@ public Response viewPeerReview(@PathParam("orcid") String orcid, @PathParam("put @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEW_SUMMARY + PUTCODE) public Response viewPeerReviewSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReviewSummary(orcid, putCode); } @@ -225,6 +244,7 @@ public Response viewPeerReviewSummary(@PathParam("orcid") String orcid, @PathPar @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEWS) public Response viewPeerReviews(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReviews(orcid); } @@ -232,6 +252,7 @@ public Response viewPeerReviews(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(RESEARCHER_URLS) public Response viewResearcherUrls(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewResearcherUrls(orcid); } @@ -239,6 +260,7 @@ public Response viewResearcherUrls(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(RESEARCHER_URLS + PUTCODE) public Response viewResearcherUrl(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewResearcherUrl(orcid, Long.valueOf(putCode)); } @@ -246,6 +268,7 @@ public Response viewResearcherUrl(@PathParam("orcid") String orcid, @PathParam(" @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMAIL) public Response viewEmails(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmails(orcid); } @@ -253,6 +276,7 @@ public Response viewEmails(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PERSONAL_DETAILS) public Response viewPersonalDetails(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPersonalDetails(orcid); } @@ -260,6 +284,7 @@ public Response viewPersonalDetails(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OTHER_NAMES) public Response viewOtherNames(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewOtherNames(orcid); } @@ -267,6 +292,7 @@ public Response viewOtherNames(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OTHER_NAMES + PUTCODE) public Response viewOtherName(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewOtherName(orcid, Long.valueOf(putCode)); } @@ -274,6 +300,7 @@ public Response viewOtherName(@PathParam("orcid") String orcid, @PathParam("putC @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EXTERNAL_IDENTIFIERS) public Response viewExternalIdentifiers(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewExternalIdentifiers(orcid); } @@ -281,6 +308,7 @@ public Response viewExternalIdentifiers(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EXTERNAL_IDENTIFIERS + PUTCODE) public Response viewExternalIdentifier(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewExternalIdentifier(orcid, Long.valueOf(putCode)); } @@ -288,6 +316,7 @@ public Response viewExternalIdentifier(@PathParam("orcid") String orcid, @PathPa @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(KEYWORDS) public Response viewKeywords(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewKeywords(orcid); } @@ -295,6 +324,7 @@ public Response viewKeywords(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(KEYWORDS + PUTCODE) public Response viewKeyword(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewKeyword(orcid, Long.valueOf(putCode)); } @@ -302,6 +332,7 @@ public Response viewKeyword(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ADDRESS) public Response viewAddresses(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewAddresses(orcid); } @@ -309,6 +340,7 @@ public Response viewAddresses(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ADDRESS + PUTCODE) public Response viewAddress(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewAddress(orcid, Long.valueOf(putCode)); } @@ -316,6 +348,7 @@ public Response viewAddress(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(BIOGRAPHY) public Response viewBiography(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewBiography(orcid); } @@ -323,6 +356,7 @@ public Response viewBiography(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PERSON) public Response viewPerson(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPerson(orcid); } @@ -331,6 +365,7 @@ public Response viewPerson(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON , JSON_LD}) @Path(OrcidApiConstants.RECORD_SIMPLE) public Response viewRecord(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewRecord(orcid); } @@ -339,6 +374,7 @@ public Response viewRecord(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OrcidApiConstants.RECORD_RECORD) public Response viewRecordRecord(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewRecord(orcid); } @@ -346,6 +382,7 @@ public Response viewRecordRecord(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(SEARCH_PATH) public Response searchByQuery(@QueryParam("q") @DefaultValue("") String query, @Context UriInfo uriInfo) { + serviceDelegator.trackEvents(httpRequest); Map> solrParams = new HashMap<>(uriInfo.getQueryParameters()); Response jsonQueryResults = serviceDelegator.searchByQuery(solrParams); return jsonQueryResults; @@ -355,6 +392,7 @@ public Response searchByQuery(@QueryParam("q") @DefaultValue("") String query, @ @Path(CLIENT_PATH) @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) public Response viewClient(@PathParam("client_id") String clientId) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewClient(clientId); } diff --git a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_1.java b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_1.java index cb6979a9c3c..d9c8799689a 100644 --- a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_1.java +++ b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_1.java @@ -80,7 +80,9 @@ public class PublicV2ApiServiceImplV2_1 { @Resource protected SwaggerUIBuilder swaggerUIBuilder; - + + @Context + private HttpServletRequest httpRequest; public void setServiceDelegator( PublicV2ApiServiceDelegator serviceDelegator) { @@ -112,6 +114,7 @@ public Response viewStatusText() { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ACTIVITIES) public Response viewActivities(@PathParam("orcid") String orcid, @Context HttpServletRequest httpRequest) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewActivities(orcid); } @@ -120,6 +123,7 @@ public Response viewActivities(@PathParam("orcid") String orcid, @Context HttpSe OrcidApiConstants.APPLICATION_CITEPROC }) @Path(WORK + PUTCODE) public Response viewWork(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode, @Context HttpServletRequest httpRequest) { + serviceDelegator.trackEvents(httpRequest); if (OrcidApiConstants.APPLICATION_CITEPROC.equals(httpRequest.getHeader("Accept"))) return serviceDelegator.viewWorkCitation(orcid, putCode); return serviceDelegator.viewWork(orcid, putCode); @@ -129,6 +133,7 @@ public Response viewWork(@PathParam("orcid") String orcid, @PathParam("putCode") @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(WORK_SUMMARY + PUTCODE) public Response viewWorkSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewWorkSummary(orcid, putCode); } @@ -136,6 +141,7 @@ public Response viewWorkSummary(@PathParam("orcid") String orcid, @PathParam("pu @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(WORKS) public Response viewWorks(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewWorks(orcid); } @@ -143,6 +149,7 @@ public Response viewWorks(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(BULK_WORKS) public Response viewSpecifiedWorks(@PathParam("orcid") String orcid, @PathParam("putCodes") String putCodes) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewBulkWorks(orcid, putCodes); } @@ -150,6 +157,7 @@ public Response viewSpecifiedWorks(@PathParam("orcid") String orcid, @PathParam( @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDING + PUTCODE) public Response viewFunding(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFunding(orcid, putCode); } @@ -157,13 +165,15 @@ public Response viewFunding(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDING_SUMMARY + PUTCODE) public Response viewFundingSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFundingSummary(orcid, putCode); } @GET @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDINGS) - public Response viewFundings(@PathParam("orcid") String orcid) { + public Response viewFundings(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFundings(orcid); } @@ -171,6 +181,7 @@ public Response viewFundings(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATION + PUTCODE) public Response viewEducation(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducation(orcid, putCode); } @@ -178,6 +189,7 @@ public Response viewEducation(@PathParam("orcid") String orcid, @PathParam("putC @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATION_SUMMARY + PUTCODE) public Response viewEducationSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducationSummary(orcid, putCode); } @@ -185,6 +197,7 @@ public Response viewEducationSummary(@PathParam("orcid") String orcid, @PathPara @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATIONS) public Response viewEducations(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducations(orcid); } @@ -192,6 +205,7 @@ public Response viewEducations(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENT + PUTCODE) public Response viewEmployment(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmployment(orcid, putCode); } @@ -199,6 +213,7 @@ public Response viewEmployment(@PathParam("orcid") String orcid, @PathParam("put @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENT_SUMMARY + PUTCODE) public Response viewEmploymentSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmploymentSummary(orcid, putCode); } @@ -206,6 +221,7 @@ public Response viewEmploymentSummary(@PathParam("orcid") String orcid, @PathPar @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENTS) public Response viewEmployments(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmployments(orcid); } @@ -213,6 +229,7 @@ public Response viewEmployments(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEW + PUTCODE) public Response viewPeerReview(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReview(orcid, putCode); } @@ -220,6 +237,7 @@ public Response viewPeerReview(@PathParam("orcid") String orcid, @PathParam("put @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEW_SUMMARY + PUTCODE) public Response viewPeerReviewSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReviewSummary(orcid, putCode); } @@ -227,6 +245,7 @@ public Response viewPeerReviewSummary(@PathParam("orcid") String orcid, @PathPar @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEWS) public Response viewPeerReviews(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReviews(orcid); } @@ -234,6 +253,7 @@ public Response viewPeerReviews(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(RESEARCHER_URLS) public Response viewResearcherUrls(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewResearcherUrls(orcid); } @@ -241,6 +261,7 @@ public Response viewResearcherUrls(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(RESEARCHER_URLS + PUTCODE) public Response viewResearcherUrl(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewResearcherUrl(orcid, Long.valueOf(putCode)); } @@ -248,6 +269,7 @@ public Response viewResearcherUrl(@PathParam("orcid") String orcid, @PathParam(" @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMAIL) public Response viewEmails(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmails(orcid); } @@ -255,6 +277,7 @@ public Response viewEmails(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PERSONAL_DETAILS) public Response viewPersonalDetails(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPersonalDetails(orcid); } @@ -262,6 +285,7 @@ public Response viewPersonalDetails(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OTHER_NAMES) public Response viewOtherNames(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewOtherNames(orcid); } @@ -269,6 +293,7 @@ public Response viewOtherNames(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OTHER_NAMES + PUTCODE) public Response viewOtherName(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewOtherName(orcid, Long.valueOf(putCode)); } @@ -276,6 +301,7 @@ public Response viewOtherName(@PathParam("orcid") String orcid, @PathParam("putC @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EXTERNAL_IDENTIFIERS) public Response viewExternalIdentifiers(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewExternalIdentifiers(orcid); } @@ -283,6 +309,7 @@ public Response viewExternalIdentifiers(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EXTERNAL_IDENTIFIERS + PUTCODE) public Response viewExternalIdentifier(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewExternalIdentifier(orcid, Long.valueOf(putCode)); } @@ -290,6 +317,7 @@ public Response viewExternalIdentifier(@PathParam("orcid") String orcid, @PathPa @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(KEYWORDS) public Response viewKeywords(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewKeywords(orcid); } @@ -297,6 +325,7 @@ public Response viewKeywords(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(KEYWORDS + PUTCODE) public Response viewKeyword(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewKeyword(orcid, Long.valueOf(putCode)); } @@ -304,6 +333,7 @@ public Response viewKeyword(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ADDRESS) public Response viewAddresses(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewAddresses(orcid); } @@ -311,6 +341,7 @@ public Response viewAddresses(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ADDRESS + PUTCODE) public Response viewAddress(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewAddress(orcid, Long.valueOf(putCode)); } @@ -318,6 +349,7 @@ public Response viewAddress(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(BIOGRAPHY) public Response viewBiography(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewBiography(orcid); } @@ -325,6 +357,7 @@ public Response viewBiography(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PERSON) public Response viewPerson(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPerson(orcid); } @@ -333,6 +366,7 @@ public Response viewPerson(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON, JSON_LD }) @Path(OrcidApiConstants.RECORD_SIMPLE) public Response viewRecord(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewRecord(orcid); } @@ -341,6 +375,7 @@ public Response viewRecord(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OrcidApiConstants.RECORD_RECORD) public Response viewRecordRecord(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewRecord(orcid); } @@ -348,6 +383,7 @@ public Response viewRecordRecord(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(SEARCH_PATH) public Response searchByQuery(@QueryParam("q") @DefaultValue("") String query, @Context UriInfo uriInfo) { + serviceDelegator.trackEvents(httpRequest); Map> solrParams = new HashMap<>(uriInfo.getQueryParameters()); Response jsonQueryResults = serviceDelegator.searchByQuery(solrParams); return jsonQueryResults; @@ -357,6 +393,7 @@ public Response searchByQuery(@QueryParam("q") @DefaultValue("") String query, @ @Path(CLIENT_PATH) @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) public Response viewClient(@PathParam("client_id") String clientId) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewClient(clientId); } } \ No newline at end of file diff --git a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/PublicV2ApiServiceDelegator.java b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/PublicV2ApiServiceDelegator.java index 5730a2d2420..b51e80e01e6 100644 --- a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/PublicV2ApiServiceDelegator.java +++ b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/PublicV2ApiServiceDelegator.java @@ -3,6 +3,7 @@ import java.util.List; import java.util.Map; +import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; /** @@ -90,4 +91,6 @@ public interface PublicV2ApiServiceDelegator Date: Fri, 5 Apr 2024 02:14:47 +0000 Subject: [PATCH 4/8] v2.57.5 changelog update --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c221313bf85..dc64407a30d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## v2.57.5 - 2024-04-05 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.57.4...v2.57.5) + +### Feature + +- Alter ip column in events to for IPV6 and add event tracking to V2 (#7019) + ## v2.57.4 - 2024-04-04 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.57.3...v2.57.4) From bceb6087bce859023358e30ab5fc40810a3aa852 Mon Sep 17 00:00:00 2001 From: Camelia Dumitru <62257307+Camelia-Orcid@users.noreply.github.com> Date: Fri, 5 Apr 2024 03:32:36 +0100 Subject: [PATCH 5/8] removed affiliation check added bio + researcherUrl check (#7018) --- .../autospam/cli/AutoLockSpamRecords.java | 38 ++++++++++++------- properties/development.properties | 5 ++- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/autospam/cli/AutoLockSpamRecords.java b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/autospam/cli/AutoLockSpamRecords.java index 3ef49c0e0a9..c3bc2534485 100644 --- a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/autospam/cli/AutoLockSpamRecords.java +++ b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/autospam/cli/AutoLockSpamRecords.java @@ -12,17 +12,21 @@ import javax.annotation.Resource; +import org.apache.commons.lang.StringUtils; import org.orcid.core.admin.LockReason; import org.orcid.core.manager.ProfileEntityCacheManager; -import org.orcid.core.manager.AffiliationsManager; + +import org.orcid.core.manager.v3.BiographyManager; import org.orcid.core.manager.v3.NotificationManager; import org.orcid.core.manager.v3.ProfileEntityManager; +import org.orcid.core.manager.v3.ResearcherUrlManager; import org.orcid.core.togglz.OrcidTogglzConfiguration; import org.orcid.core.utils.OrcidStringUtils; -import org.orcid.jaxb.model.record_v2.Affiliation; + +import org.orcid.jaxb.model.v3.release.record.Biography; +import org.orcid.jaxb.model.v3.release.record.ResearcherUrls; import org.orcid.persistence.dao.OrcidOauth2TokenDetailDao; import org.orcid.persistence.jpa.entities.ProfileEntity; -import org.orcid.pojo.ajaxForm.PojoUtil; import org.orcid.scheduler.autospam.AutospamEmailSender; import org.orcid.utils.alerting.SlackManager; import org.slf4j.Logger; @@ -102,9 +106,15 @@ public class AutoLockSpamRecords { @Resource private AutospamEmailSender autospamEmailSender; - - @Resource - private AffiliationsManager affiliationsManager; + + + @Resource(name = "biographyManagerV3") + private BiographyManager biographyManager; + + @Resource(name = "researcherUrlManagerV3") + private ResearcherUrlManager researcherUrlManager; + + // for running spam manually public static void main(String[] args) { @@ -135,21 +145,22 @@ private void autolockRecords(List toLock) { // and not have an auth token if (profileEntity != null && !profileEntity.isReviewed() && profileEntity.isAccountNonLocked() && !orcidOauthDao.hasToken(orcidId)) { - List affiliations = affiliationsManager.getAffiliations(orcidId); - // Lock only if doesn't have any affiliations - if (affiliations == null || affiliations.size() < 1) { - boolean wasLocked = profileEntityManager.lockProfile(orcidId, LockReason.SPAM_AUTO.getLabel(), "ML Detected", ""); + //check if it has biography + Biography bio= biographyManager.getBiography(orcidId); + ResearcherUrls researcherUrls = researcherUrlManager.getResearcherUrls(orcidId); + + if(( bio !=null && StringUtils.isNotBlank(bio.getContent()) || (researcherUrls != null && researcherUrls.getResearcherUrls() != null && researcherUrls.getResearcherUrls().size() > 0))){ + boolean wasLocked = profileEntityManager.lockProfile(orcidId, LockReason.SPAM_AUTO.getLabel(), "ML Detected", ""); if (wasLocked) { autospamEmailSender.sendOrcidLockedEmail(orcidId); accountsLocked++; } - } + } } lastOrcidProcessed = orcidId; } } catch (Exception e) { LOG.error("Exception when locking spam record " + orcidId, e); - slackManager.sendAlert("Exception when locking spam record " + orcidId + ". LastOrcid processed is: " + lastOrcidProcessed, slackChannel, slackUser, webhookUrl); LOG.info("LastOrcid processed is: " + lastOrcidProcessed); e.printStackTrace(); } @@ -197,7 +208,8 @@ private void init() { notificationManager = (NotificationManager) context.getBean("notificationManagerV3"); autospamEmailSender = (AutospamEmailSender) context.getBean("autospamEmailSender"); orcidOauthDao = (OrcidOauth2TokenDetailDao) context.getBean("orcidOauth2TokenDetailDao"); - affiliationsManager = (AffiliationsManager) context.getBean("affiliationsManager"); + biographyManager = (BiographyManager) context.getBean("biographyManagerV3"); + researcherUrlManager = (ResearcherUrlManager) context.getBean("researcherUrlManagerV3"); bootstrapTogglz(context.getBean(OrcidTogglzConfiguration.class)); } diff --git a/properties/development.properties b/properties/development.properties index de9a4064834..9a6da83976f 100644 --- a/properties/development.properties +++ b/properties/development.properties @@ -249,9 +249,10 @@ org.orcid.message-listener.s3.secretKey=xx org.orcid.scheduler.aws.bucket=auto-spam-qa org.orcid.scheduler.aws.file=orcidspam.csv org.orcid.scheduler.autospam.enabled=false -org.orcid.scheduler.autospam.file=orcidspam.csv -org.orcid.scheduler.autospam.daily.batch=1 +org.orcid.scheduler.autospam.file=/Users/camdum/Desktop/orcidspam.csv +org.orcid.scheduler.autospam.daily.batch=20000 org.orcid.scheduler.autospam.process=0 0 0 * * MON +org.orcid.scheduler.autospam.enabled=true # Slack org.orcid.core.autospam.slackChannel=collab-spam-reports From 738da000a6fee922424f2ecf79af2e8e79822c83 Mon Sep 17 00:00:00 2001 From: github actions Date: Fri, 5 Apr 2024 02:45:45 +0000 Subject: [PATCH 6/8] v2.57.6 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc64407a30d..1d2d3f69f70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.57.6 - 2024-04-05 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.57.5...v2.57.6) + ## v2.57.5 - 2024-04-05 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.57.4...v2.57.5) From 4f19aa5382966f8dd35e4195fb1da78e270f29c2 Mon Sep 17 00:00:00 2001 From: Daniel Palafox Date: Fri, 5 Apr 2024 13:27:00 -0600 Subject: [PATCH 7/8] fix: Add togglz to track PAPI events (#7021) Co-authored-by: Daniel Palafox --- .../src/main/java/org/orcid/core/togglz/Features.java | 1 - .../delegator/impl/PublicV2ApiServiceDelegatorImpl.java | 9 ++++++--- .../delegator/impl/PublicV3ApiServiceDelegatorImpl.java | 9 ++++++--- 3 files changed, 12 insertions(+), 7 deletions(-) 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 42e0745b55d..b571445ea78 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 @@ -18,7 +18,6 @@ public enum Features implements Feature { @Label("Registration 2.1: Add affiliations on registration") REGISTRATION_2_1, - @Label("Registration 2.0") REGISTRATION_2_0, diff --git a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/impl/PublicV2ApiServiceDelegatorImpl.java b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/impl/PublicV2ApiServiceDelegatorImpl.java index 9df437e5449..ab2db9a891b 100644 --- a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/impl/PublicV2ApiServiceDelegatorImpl.java +++ b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/impl/PublicV2ApiServiceDelegatorImpl.java @@ -43,6 +43,7 @@ import org.orcid.core.manager.read_only.ResearcherUrlManagerReadOnly; import org.orcid.core.manager.read_only.WorkManagerReadOnly; import org.orcid.core.oauth.openid.OpenIDConnectKeyService; +import org.orcid.core.togglz.Features; import org.orcid.core.utils.ContributorUtils; import org.orcid.core.utils.OrcidRequestUtil; import org.orcid.core.utils.SourceUtils; @@ -638,10 +639,12 @@ public Response viewClient(String clientId) { @Override public void trackEvents(HttpServletRequest httpRequest) { - String clientId = orcidSecurityManager.getClientIdFromAPIRequest(); - String ip = OrcidRequestUtil.getIpAddress(httpRequest); + if (Features.PAPI_EVENTS.isActive()) { + String clientId = orcidSecurityManager.getClientIdFromAPIRequest(); + String ip = OrcidRequestUtil.getIpAddress(httpRequest); - eventManager.createPapiEvent(clientId, ip, clientId == null ? true : false); + eventManager.createPapiEvent(clientId, ip, clientId == null ? true : false); + } } } diff --git a/orcid-pub-web/src/main/java/org/orcid/api/publicV3/server/delegator/impl/PublicV3ApiServiceDelegatorImpl.java b/orcid-pub-web/src/main/java/org/orcid/api/publicV3/server/delegator/impl/PublicV3ApiServiceDelegatorImpl.java index f714009c6c3..a1da0abcd31 100644 --- a/orcid-pub-web/src/main/java/org/orcid/api/publicV3/server/delegator/impl/PublicV3ApiServiceDelegatorImpl.java +++ b/orcid-pub-web/src/main/java/org/orcid/api/publicV3/server/delegator/impl/PublicV3ApiServiceDelegatorImpl.java @@ -46,6 +46,7 @@ import org.orcid.core.manager.v3.read_only.ResearcherUrlManagerReadOnly; import org.orcid.core.manager.v3.read_only.WorkManagerReadOnly; import org.orcid.core.oauth.openid.OpenIDConnectKeyService; +import org.orcid.core.togglz.Features; import org.orcid.core.utils.OrcidRequestUtil; import org.orcid.core.utils.v3.ContributorUtils; import org.orcid.core.utils.v3.SourceUtils; @@ -969,10 +970,12 @@ public Response viewResearchResourceSummary(String orcid, Long putCode) { @Override public void trackEvents(HttpServletRequest httpRequest) { - String clientId = orcidSecurityManager.getClientIdFromAPIRequest(); - String ip = OrcidRequestUtil.getIpAddress(httpRequest); + if (Features.PAPI_EVENTS.isActive()) { + String clientId = orcidSecurityManager.getClientIdFromAPIRequest(); + String ip = OrcidRequestUtil.getIpAddress(httpRequest); - eventManager.createPapiEvent(clientId, ip, clientId == null ? true : false); + eventManager.createPapiEvent(clientId, ip, clientId == null ? true : false); + } } } From 3c26ac6d9171f5dc82e8fc989e8c4963025be7a9 Mon Sep 17 00:00:00 2001 From: github actions Date: Fri, 5 Apr 2024 19:42:04 +0000 Subject: [PATCH 8/8] v2.57.7 changelog update --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d2d3f69f70..beb9a6309e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## v2.57.7 - 2024-04-05 + +[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.57.6...v2.57.7) + +### Fix + +- Add togglz to track PAPI events (#7021) + ## v2.57.6 - 2024-04-05 [Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.57.5...v2.57.6)