Skip to content

Commit

Permalink
Fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
amontenegro committed Nov 13, 2023
1 parent bb79ca3 commit c5c5b9f
Show file tree
Hide file tree
Showing 197 changed files with 2,299 additions and 11,120 deletions.
156 changes: 156 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,159 @@
## v2.44.7 - 2023-11-09

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

- [#6927](https://github.com/ORCID/ORCID-Source/pull/6927): Add more logging for when the request changes during oauth

## v2.44.6 - 2023-11-08

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

- [#6926](https://github.com/ORCID/ORCID-Source/pull/6926): fix: Add create event to ShibbolethController and Add missing member …

### Fix

- Add create event to ShibbolethController and Add missing member name

## v2.44.5 - 2023-11-03

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

- [#6925](https://github.com/ORCID/ORCID-Source/pull/6925): Is there is more than one org with no parent, we should not suggest a…

## v2.44.4 - 2023-11-02

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

- [#6923](https://github.com/ORCID/ORCID-Source/pull/6923): Welcome email ready to go

## v2.44.3 - 2023-11-01

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

- [#6924](https://github.com/ORCID/ORCID-Source/pull/6924): fix: Add missing `last_modified` in events view so panoply can run su…

### Fix

- Add missing `last_modified` in events view so panoply can run successfully

## v2.44.2 - 2023-10-31

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

- [#6922](https://github.com/ORCID/ORCID-Source/pull/6922): fix: Add missing create event method for social sign in

### Fix

- Add missing togglz for events in social sign in
- Add missing create event method for social sign in

## v2.44.1 - 2023-10-31

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

- [#6921](https://github.com/ORCID/ORCID-Source/pull/6921): Send the reminders at different time by default

## v2.44.0 - 2023-10-30

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

## v2.43.6 - 2023-10-30

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

- [#6908](https://github.com/ORCID/ORCID-Source/pull/6908): Bump @babel/traverse from 7.17.9 to 7.23.2 in /orcid-web/src/main/webapp/static/javascript/ng1Orcid

## v2.43.5 - 2023-10-30

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

## v2.43.4 - 2023-10-30

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

- [#6915](https://github.com/ORCID/ORCID-Source/pull/6915): 8875 update the email verification schedule to send emails 2 7 and 28 days after email creation
- [#6917](https://github.com/ORCID/ORCID-Source/pull/6917): fix: Add indexes to event table
- [#6919](https://github.com/ORCID/ORCID-Source/pull/6919): Bump browserify-sign from 4.2.1 to 4.2.2 in /orcid-web/src/main/webapp/static/javascript/ng1Orcid

### Fix

- Add indexes to event table

## v2.43.3 - 2023-10-30

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

- [#6918](https://github.com/ORCID/ORCID-Source/pull/6918): 8889 prod looks like the ror loader is broken

## v2.43.2 - 2023-10-25

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

- [#6916](https://github.com/ORCID/ORCID-Source/pull/6916): fix: Invert selfAsserted and validated in sort by source

### Fix

- Invert selfAsserted and validated in sort by source

## v2.43.1 - 2023-10-25

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

- [#6914](https://github.com/ORCID/ORCID-Source/pull/6914): Shorter id

## v2.43.0 - 2023-10-25

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

- [#6913](https://github.com/ORCID/ORCID-Source/pull/6913): feature: Add functionality to capture user events in the database and…

### Fix

- Add missing label and fix test

### Feature

- Add functionality to capture user events in the database and create views to display info in panoply

## v2.42.6 - 2023-10-24

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

- [#6912](https://github.com/ORCID/ORCID-Source/pull/6912): add an option to configure timeout

## v2.42.5 - 2023-10-23

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

- [#6909](https://github.com/ORCID/ORCID-Source/pull/6909): fix: Update sort by source functionality to sort also alphabetically

### Fix

- Update external identifier is validates method
- Update sort by source functionality to sort also alphabetically

## v2.42.4 - 2023-10-20

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

- [#6907](https://github.com/ORCID/ORCID-Source/pull/6907): fix/remove-fundingSubType-core-details-from-codebase

### Fix

- remove fundingSubType core config manually removed from prod

## v2.42.3 - 2023-10-20

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

- [#6911](https://github.com/ORCID/ORCID-Source/pull/6911): Initial commit

## v2.42.2 - 2023-10-20

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

- [#6910](https://github.com/ORCID/ORCID-Source/pull/6910): 8855 duplicate isni external identifiers for same disambiguated organisation

## v2.42.1 - 2023-10-13

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.42.0...v2.42.1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,6 @@
<constructor-arg index="1" value="${org.orcid.core.utils.cache.redis.port}" />
<constructor-arg index="2" value="${org.orcid.core.utils.cache.redis.password}" />
<constructor-arg index="3" value="${org.orcid.core.utils.cache.redis.expiration_in_secs:600}" />
<constructor-arg index="4" value="${org.orcid.core.utils.cache.redis.connection_timeout_millis:10000}" />
</bean>
</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

import java.util.List;

import org.orcid.core.common.manager.impl.EmailDomainManagerImpl.STATUS;
import org.orcid.persistence.jpa.entities.EmailDomainEntity;

public interface EmailDomainManager {
EmailDomainEntity createEmailDomain(String emailDomain, EmailDomainEntity.DomainCategory category);

boolean updateCategory(long id, EmailDomainEntity.DomainCategory category);

EmailDomainEntity findByEmailDoman(String emailDomain);

List<EmailDomainEntity> findByCategory(EmailDomainEntity.DomainCategory category);

STATUS createOrUpdateEmailDomain(String emailDomain, String rorId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.orcid.core.common.manager;

import org.orcid.core.utils.EventType;
import org.orcid.pojo.ajaxForm.RequestInfoForm;

import javax.servlet.http.HttpServletRequest;

/**
*
* @author Daniel Palafox
*
*/
public interface EventManager {

boolean removeEvents(String orcid);

void createEvent(String orcid, EventType eventType, HttpServletRequest request);

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@

public class EmailDomainManagerImpl implements EmailDomainManager {

public enum STATUS {CREATED, UPDATED};

@Resource(name = "emailDomainDao")
private EmailDomainDao emailDomainDao;

@Resource(name = "emailDomainDaoReadOnly")
private EmailDomainDao emailDomainDaoReadOnly;

@Override
public EmailDomainEntity createEmailDomain(String emailDomain, DomainCategory category) {
private void validateEmailDomain(String emailDomain) {
if (emailDomain == null || emailDomain.isBlank()) {
throw new IllegalArgumentException("Email Domain must not be empty");
}
if(!InternetDomainName.isValid(emailDomain)) {
throw new IllegalArgumentException("Email Domain '" + emailDomain + "' is invalid");
}
}

@Override
public EmailDomainEntity createEmailDomain(String emailDomain, DomainCategory category) {
validateEmailDomain(emailDomain);
if (category == null) {
throw new IllegalArgumentException("Category must not be empty");
}
Expand Down Expand Up @@ -57,4 +63,22 @@ public List<EmailDomainEntity> findByCategory(DomainCategory category) {
return emailDomainDaoReadOnly.findByCategory(category);
}

@Override
public STATUS createOrUpdateEmailDomain(String emailDomain, String rorId) {
EmailDomainEntity existingEntity = emailDomainDaoReadOnly.findByEmailDoman(emailDomain);
if(existingEntity != null) {
if(!rorId.equals(existingEntity.getRorId())) {
boolean updated = emailDomainDao.updateRorId(existingEntity.getId(), rorId);
if(updated)
return STATUS.UPDATED;
}
} else {
EmailDomainEntity newEntity = emailDomainDao.createEmailDomain(emailDomain, DomainCategory.PROFESSIONAL, rorId);
if (newEntity != null) {
return STATUS.CREATED;
}
}
return null;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
package org.orcid.core.common.manager.impl;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.orcid.core.common.manager.EventManager;
import org.orcid.core.constants.OrcidOauth2Constants;
import org.orcid.core.manager.ClientDetailsEntityCacheManager;
import org.orcid.core.manager.v3.read_only.RecordNameManagerReadOnly;
import org.orcid.core.utils.EventType;
import org.orcid.jaxb.model.clientgroup.ClientType;
import org.orcid.jaxb.model.v3.release.record.Name;
import org.orcid.persistence.dao.EventDao;
import org.orcid.persistence.jpa.entities.ClientDetailsEntity;
import org.orcid.persistence.jpa.entities.EventEntity;
import org.orcid.pojo.ajaxForm.PojoUtil;
import org.orcid.pojo.ajaxForm.RequestInfoForm;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;

/**
*
* @author Daniel Palafox
*
*/
public class EventManagerImpl implements EventManager {

@Resource
private EventDao eventDao;

@Resource
private ClientDetailsEntityCacheManager clientDetailsEntityCacheManager;

@Resource(name = "recordNameManagerReadOnlyV3")
private RecordNameManagerReadOnly recordNameManagerReadOnly;

@Override
public boolean removeEvents(String orcid) {
return eventDao.removeEvents(orcid);
}

@Override
public void createEvent(String orcid, EventType eventType, HttpServletRequest request) {
String label = "Website";
String clientId = null;
String redirectUrl = null;
String publicPage = null;

if (eventType == EventType.PUBLIC_PAGE) {
publicPage = orcid;
orcid = null;
} else {
if (request != null) {
Boolean isOauth2ScreensRequest = (Boolean) request.getSession().getAttribute(OrcidOauth2Constants.OAUTH_2SCREENS);
RequestInfoForm requestInfoForm = (RequestInfoForm) request.getSession().getAttribute("requestInfoForm");
if (requestInfoForm != null) {
clientId = requestInfoForm.getClientId();
redirectUrl = removeAttributesFromUrl(requestInfoForm.getRedirectUrl());
label = "OAuth " + requestInfoForm.getMemberName() + " " + requestInfoForm.getClientName();
} else if (isOauth2ScreensRequest != null && isOauth2ScreensRequest) {
String queryString = (String) request.getSession().getAttribute(OrcidOauth2Constants.OAUTH_QUERY_STRING);
clientId = getParameterValue(queryString, "client_id");
redirectUrl = getParameterValue(queryString, "redirect_uri");
ClientDetailsEntity clientDetailsEntity = clientDetailsEntityCacheManager.retrieve(clientId);
String memberName = "";
String clientName = clientDetailsEntity.getClientName();

if (ClientType.PUBLIC_CLIENT.equals(clientDetailsEntity.getClientType())) {
memberName = "PubApp";
} else if (!PojoUtil.isEmpty(clientDetailsEntity.getGroupProfileId())) {
Name name = recordNameManagerReadOnly.getRecordName(clientDetailsEntity.getGroupProfileId());
if (name != null) {
memberName = name.getCreditName() != null ? name.getCreditName().getContent() : "";
}
}

if (StringUtils.isBlank(memberName)) {
memberName = clientName;
}
label = "OAuth " + memberName + " " + clientName;
}
}
}

EventEntity eventEntity = new EventEntity();

eventEntity.setOrcid(orcid);
eventEntity.setEventType(eventType.getValue());
eventEntity.setClientId(clientId);
eventEntity.setRedirectUrl(redirectUrl);
eventEntity.setLabel(label);
eventEntity.setPublicPage(publicPage);

eventDao.createEvent(eventEntity);
}

private String getParameterValue(String queryString, String parameter) {
if (StringUtils.isNotEmpty(queryString)) {
try {
queryString = URLDecoder.decode(queryString, StandardCharsets.UTF_8.toString());
} catch (UnsupportedEncodingException u) {
// l
}
String[] parameters = queryString.split("&");
for (String p : parameters) {
String[] keyValuePair = p.split("=");
if (parameter.equals(keyValuePair[0])) {
return keyValuePair[1];
}
}
}
return null;
}

private String removeAttributesFromUrl(String url) {
if (url.contains("?")) {
return url.substring(0, url.indexOf("?"));
}
return url;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ public interface OrgDisambiguatedManager {
void createOrgDisambiguatedExternalIdentifier(OrgDisambiguatedExternalIdentifierEntity identifier);

public List<OrgDisambiguated> findOrgDisambiguatedIdsForSameExternalIdentifier(String identifier, String type);

public void cleanDuplicatedExternalIdentifiersForOrgDisambiguated(OrgDisambiguatedEntity orgDisambiguatedEntity);

}
Loading

0 comments on commit c5c5b9f

Please sign in to comment.