Skip to content

Commit

Permalink
Merge branch 'main' into 8934-registration-add-an-affiliation-with-ty…
Browse files Browse the repository at this point in the history
…peahead
  • Loading branch information
leomendoza123 authored Jan 11, 2024
2 parents 5ce310b + 0a5e62e commit 4b6a029
Show file tree
Hide file tree
Showing 79 changed files with 1,312 additions and 113 deletions.
5 changes: 5 additions & 0 deletions .tx/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,8 @@ filters:
source_language: en
translation_files_expression: orcid-core/src/main/resources/i18n/layout_<lang>.properties
source_file: orcid-core/src/main/resources/i18n/layout_en.properties
- filter_type: file
file_format: UNICODEPROPERTIES
source_language: en
translation_files_expression: orcid-core/src/main/resources/i18n/email_add_works_to_record_<lang>.properties
source_file: orcid-core/src/main/resources/i18n/email_add_works_to_record_en.properties
101 changes: 101 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,104 @@
## v2.49.1 - 2024-01-08

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.49.0...v2.49.1)

- [#6968](https://github.com/ORCID/ORCID-Source/pull/6968): fix: Update change set id for `dw_event_stats`

### Fix

- Update change set id for `dw_event_stats`

## v2.49.0 - 2024-01-08

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.48.3...v2.49.0)

- [#6960](https://github.com/ORCID/ORCID-Source/pull/6960): feature: Add cron job to delete events and create events stats

### Fix

- Update event stats test
- Update delete query and fix tests

### Feature

- Create dw_event_stats view and remove dw_even and dw_event_public
- Add cron job to delete events and create events stats

## v2.48.3 - 2024-01-08

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.48.2...v2.48.3)

- [#6967](https://github.com/ORCID/ORCID-Source/pull/6967): Increase version to 3.3.0

## v2.48.2 - 2024-01-05

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.48.1...v2.48.2)

- [#6966](https://github.com/ORCID/ORCID-Source/pull/6966): Remove few togglz from print view

## v2.48.1 - 2024-01-03

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.48.0...v2.48.1)

- [#6965](https://github.com/ORCID/ORCID-Source/pull/6965): fix: Add OL identifier case sensitive and RRID regex validator
- [#6942](https://github.com/ORCID/ORCID-Source/pull/6942): feature: Add affiliation when a new user registers

### Fix

- Add OL identifier case sensitive and RRID regex validator
- Update registration togglz
- Reorganize initdb scripts

### Feature

- Add affiliation when a new user registers

## v2.48.0 - 2024-01-03

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.47.11...v2.48.0)

## v2.47.11 - 2024-01-03

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.47.10...v2.47.11)

- [#6962](https://github.com/ORCID/ORCID-Source/pull/6962): Repurposed plain text status checks for the APIs into simple json check.

## v2.47.10 - 2024-01-02

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.47.9...v2.47.10)

- [#6964](https://github.com/ORCID/ORCID-Source/pull/6964): Missing tx files

## v2.47.9 - 2024-01-02

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.47.8...v2.47.9)

- [#6963](https://github.com/ORCID/ORCID-Source/pull/6963): Research outputs email

## v2.47.8 - 2024-01-02

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.47.7...v2.47.8)

- [#6961](https://github.com/ORCID/ORCID-Source/pull/6961): OCID to ORCID

## v2.47.7 - 2023-12-27

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.47.6...v2.47.7)

- [#6959](https://github.com/ORCID/ORCID-Source/pull/6959): Add unit tests

## v2.47.6 - 2023-12-26

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.47.5...v2.47.6)

- [#6958](https://github.com/ORCID/ORCID-Source/pull/6958): Remove the ENABLE_RECORD_CREATE_ENDPOINT togglz

## v2.47.5 - 2023-12-20

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.47.4...v2.47.5)

- [#6957](https://github.com/ORCID/ORCID-Source/pull/6957): Add works email granular config props

## v2.47.4 - 2023-12-19

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.47.3...v2.47.4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,12 @@ public Response viewSwaggerO2c() {
* @return Plain text message indicating health of service
*/
@GET
@Produces(value = { MediaType.TEXT_PLAIN })
@Produces(value = { MediaType.APPLICATION_JSON })
@Path(STATUS_PATH)
public Response viewStatusText() {
return serviceDelegator.viewStatusText();
public Response viewStatusSimple() {
httpRequest.setAttribute("skipAccessLog", true);
httpRequest.setAttribute("isMonitoring", true);
return serviceDelegator.viewStatusSimple();
}

@GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface MemberV3ApiServiceDelegator<DISTINCTION, EDUCATION, EMPLOYMENT,

static final String LATEST_V3_VERSION = "3.0";

Response viewStatusText();
Response viewStatusSimple();

Response viewStatus();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,9 @@ public void setFilterVersionOfIdentifiers(Boolean filterVersionOfIdentifiers) {
}

@Override
public Response viewStatusText() {
return Response.ok(STATUS_OK_MESSAGE).build();
public Response viewStatusSimple() {
Map<String, Boolean> statusMap = statusManager.createStatusMapSimple();
return Response.ok(statusMap).build();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<sec:http pattern="/v3**/o2c.html" security="none"/>

<!-- Status check -->
<sec:http pattern="/v*/status" security="none"/>
<sec:http pattern="/v*/apiStatus" security="none"/>

<!-- Authenticate the client before reaching the token endpoint -->
Expand Down
2 changes: 1 addition & 1 deletion orcid-api-web/tutorial/peer-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Editing the peer-review section of a record requires a 3 step OAuth token with t

- **subject-container-name** _(optional)_ The name of the journal, conference, grant review panel, or other applicable object of which the review subject was a part.

- **subject-type** _(optional)_ The type of object that was reviewed, if used this field must be selected from the list of [supported work types](https://members.orcid.org/api/resources/work-types).
- **subject-type** _(optional)_ The type of object that was reviewed, if used this field must be selected from the list of [supported work types](https://info.orcid.org/ufaqs/what-work-types-does-orcid-support/).

- **subject-name** _(optional)_ The name/title of the subject object that was reviewed.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ public interface StatusManager {
String TOMCAT_UP = "tomcatUp";

Map<String, Boolean> createStatusMap();

Map<String, Boolean> createStatusMapSimple();

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@
import org.orcid.core.manager.ProfileEntityCacheManager;
import org.orcid.core.manager.ProfileEntityManager;
import org.orcid.core.manager.RegistrationManager;
import org.orcid.core.manager.v3.AffiliationsManager;
import org.orcid.core.manager.v3.EmailManager;
import org.orcid.core.manager.v3.NotificationManager;
import org.orcid.core.manager.v3.RecordNameManager;
import org.orcid.core.security.OrcidWebRole;
import org.orcid.core.togglz.Features;
import org.orcid.core.utils.VerifyRegistrationToken;
import org.orcid.jaxb.model.common.AvailableLocales;
import org.orcid.jaxb.model.common_v2.OrcidType;
import org.orcid.jaxb.model.common_v2.Visibility;
import org.orcid.jaxb.model.message.CreationMethod;
import org.orcid.jaxb.model.v3.release.record.Affiliation;
import org.orcid.jaxb.model.v3.release.record.Employment;
import org.orcid.jaxb.model.v3.release.record.FamilyName;
import org.orcid.jaxb.model.v3.release.record.GivenNames;
import org.orcid.jaxb.model.v3.release.record.Name;
Expand Down Expand Up @@ -90,6 +94,9 @@ public class RegistrationManagerImpl implements RegistrationManager {

@Resource(name = "recordNameManagerV3")
private RecordNameManager recordNameManager;

@Resource(name = "affiliationsManagerV3")
private AffiliationsManager affiliationsManager;

@Required
public void setEncryptionManager(EncryptionManager encryptionManager) {
Expand Down Expand Up @@ -290,7 +297,12 @@ private String createMinimalProfile(Registration registration, boolean usedCaptc
name.setGivenNames(new GivenNames(registration.getGivenNames().getValue()));
}
recordNameManager.createRecordName(orcid, name);


if (Features.REGISTRATION_2_0.isActive() && registration.getAffiliationForm() != null) {
Affiliation affiliation = registration.getAffiliationForm().toAffiliation();
affiliationsManager.createEmploymentAffiliation(orcid, (Employment) affiliation, false);
}

// Create email frequency entity
boolean sendQuarterlyTips = (registration.getSendOrcidNews() == null) ? false : registration.getSendOrcidNews().getValue();
emailFrequencyManager.createOnRegister(orcid, SendEmailFrequency.WEEKLY, SendEmailFrequency.WEEKLY, SendEmailFrequency.WEEKLY, sendQuarterlyTips);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public Map<String, Boolean> createStatusMap() {
return result;
}

@Override
public Map<String, Boolean> createStatusMapSimple() {
Map<String, Boolean> result = new LinkedHashMap<>();
result.put(TOMCAT_UP, true);
return result;
}

private boolean isConnectionOk(MiscDao miscDao) {
try {
Date dbDate = miscDao.retrieveDatabaseDatetime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected OAuth2Authentication getOAuth2Authentication(ClientDetails client, Tok
OrcidOauth2AuthoriziationCodeDetail codeDetails = orcidOauth2AuthoriziationCodeDetailDao.find(authorizationCode);
if(codeDetails == null) {
int numDisabled = orcidOauthTokenDetailService.disableAccessTokenByCodeAndClient(authorizationCode, tokenRequest.getClientId(), RevokeReason.AUTH_CODE_REUSED);
if (numDisabled >0){
if (numDisabled > 0) {
throw new InvalidGrantException("Reused authorization code: " + authorizationCode);
}
throw new InvalidGrantException("Invalid authorization code: " + authorizationCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,16 @@ public boolean doesClientKnowUser(String clientId, String userOrcid) {
@Override
@Transactional
public int disableAccessTokenByCodeAndClient(String authorizationCode, String clientID, RevokeReason reason) {
// Find the tokens to disable
List<String> tokensToDisable = orcidOauth2TokenDetailDao.findAccessTokenByCodeAndClient(authorizationCode, clientID);
// Remove them from the cache
for(String accessToken : tokensToDisable) {
LOGGER.info("Token {} will be disabled because auth code {} was reused", accessToken, authorizationCode);
if(isTokenCacheEnabled) {
redisClient.remove(accessToken);
}
}
// Disable them
return orcidOauth2TokenDetailDao.disableAccessTokenByCodeAndClient(authorizationCode, clientID, reason.name());
}

Expand Down
10 changes: 5 additions & 5 deletions orcid-core/src/main/java/org/orcid/core/togglz/Features.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ public enum Features implements Feature {
CRAZY_EGG,

@Label("HelpHero")
ORCID_ANGULAR_HELP_HERO,

@Label("Enable the API record create endpoint for QA purposes")
ENABLE_RECORD_CREATE_ENDPOINT,
ORCID_ANGULAR_HELP_HERO,

@Label("Stop caching works when doing bulk reads")
READ_BULK_WORKS_DIRECTLY_FROM_DB,
Expand All @@ -43,7 +40,10 @@ public enum Features implements Feature {
SEND_ALL_VERIFICATION_EMAILS,

@Label("Send add works emails for 7, 28 and 90 days.")
SEND_ADD_WORKS_EMAILS;
SEND_ADD_WORKS_EMAILS,

@Label("Delete events older than 90 days from the DB ")
DELETE_EVENTS;

public boolean isActive() {
return FeatureContext.getFeatureManager().isActive(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.orcid.utils.alerting.SlackManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;

import redis.clients.jedis.DefaultJedisClientConfig;
import redis.clients.jedis.HostAndPort;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
package org.orcid.core.utils.v3.identifiers.normalizers;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

import com.google.common.collect.Lists;

@Component
public class CurieNormalizer implements Normalizer {
public class CurieNormalizer implements NormalizerWithURLTransform {

private static final List<String> canHandle = Lists.newArrayList("rrid");
private static final Pattern pattern = Pattern.compile("(?:(?i)RRID:)?(AB_\\d{6}|CVCL_[0-9A-Z]{4}|SCR_\\d{6}|IMSR_JAX\\:\\d{6}|Addgene_\\d{5}|SAMN\\d{8}|MMRRC_\\d{6}-UCD)");

@Override
public List<String> canHandle() {
Expand All @@ -19,16 +22,29 @@ public List<String> canHandle() {

@Override
public String normalise(String apiTypeName, String value) {
if (!canHandle.contains(apiTypeName))
return value;
if (!value.startsWith(apiTypeName.toUpperCase() + ":"))
return apiTypeName.toUpperCase() + ":" + value;
return value;
return curieIdentifier(apiTypeName, value);
}

@Override
public int getOrder() {
return Ordered.LOWEST_PRECEDENCE;
}

@Override
public String normaliseURL(String apiTypeName, String value) {
return curieIdentifier(apiTypeName, value);
}

private String curieIdentifier(String apiTypeName, String value) {
if (!canHandle.contains(apiTypeName))
return value;
Matcher m = pattern.matcher(value);
if (m.find()){
String n = m.group(1);
if (n != null){
return "RRID:"+n;
}
}
return "";
}
}
10 changes: 10 additions & 0 deletions orcid-core/src/main/java/org/orcid/pojo/ajaxForm/Registration.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public class Registration implements ErrorsInterface, Serializable {

private String linkType;

private AffiliationForm affiliationForm;

public Registration() {
errors = new ArrayList<String>();
password = new Text();
Expand Down Expand Up @@ -241,4 +243,12 @@ public String getLinkType() {
public void setLinkType(String linkType) {
this.linkType = linkType;
}

public AffiliationForm getAffiliationForm() {
return affiliationForm;
}

public void setAffiliationForm(AffiliationForm affiliationForm) {
this.affiliationForm = affiliationForm;
}
}
Loading

0 comments on commit 4b6a029

Please sign in to comment.