Skip to content

Commit

Permalink
Merge branch 'main' into transifex
Browse files Browse the repository at this point in the history
  • Loading branch information
leomendoza123 authored Nov 17, 2023
2 parents a89b3bb + e5687dc commit 6484fe6
Show file tree
Hide file tree
Showing 26 changed files with 458 additions and 425 deletions.
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
## v2.44.12 - 2023-11-16

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

- [#6936](https://github.com/ORCID/ORCID-Source/pull/6936): fix: Add missing capture event in shibboleth account link
- [#6935](https://github.com/ORCID/ORCID-Source/pull/6935): allways send 2 days reminder
- [#6934](https://github.com/ORCID/ORCID-Source/pull/6934): Fix NPE on social sign in

### Fix

- Add missing capture event in shibboleth account link

## v2.44.11 - 2023-11-16

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

- [#6933](https://github.com/ORCID/ORCID-Source/pull/6933): Add missing keys

## v2.44.10 - 2023-11-16

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

- [#6932](https://github.com/ORCID/ORCID-Source/pull/6932): Just one query

## v2.44.9 - 2023-11-14

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

- [#6930](https://github.com/ORCID/ORCID-Source/pull/6930): Remove orcid, redirect_url, public_page and last_modified from event

## v2.44.8 - 2023-11-14

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

- [#6929](https://github.com/ORCID/ORCID-Source/pull/6929): Changed the code to use triples

## 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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
package org.orcid.core.common.manager;

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

import javax.servlet.http.HttpServletRequest;

import org.orcid.core.utils.EventType;

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

boolean removeEvents(String orcid);

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

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

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

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
Expand All @@ -30,47 +35,49 @@ public class EventManagerImpl implements EventManager {
@Resource
private ClientDetailsEntityCacheManager clientDetailsEntityCacheManager;

@Override
public boolean removeEvents(String orcid) {
return eventDao.removeEvents(orcid);
}
@Resource(name = "recordNameManagerReadOnlyV3")
private RecordNameManagerReadOnly recordNameManagerReadOnly;

@Override
public void createEvent(String orcid, EventType eventType, HttpServletRequest request, RequestInfoForm requestInfoForm) {
public void createEvent(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);
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);
label = "OAuth " + clientDetailsEntity.getClientName();
}
} else if (requestInfoForm != null) {
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.getClientName();
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");
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);

eventEntity.setDateCreated(new Date());
eventDao.createEvent(eventEntity);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ email.common.email.preferences=LR
email.common.privacy_policy=LR
email.common.privacy_policy_2=LR
email.common.address1=LR
email.common.address2=LR
email.common.address2=LR
email.welcome.your_id.id=LR
email.welcome.your_id.link=LR
email.common.received_email_as_service=LR
3 changes: 3 additions & 0 deletions orcid-core/src/main/resources/i18n/email_common_rl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ email.common.privacy_policy=RL
email.common.privacy_policy_2=RL
email.common.address1=RL
email.common.address2=RL
email.welcome.your_id.id=RL
email.welcome.your_id.link=RL
email.common.received_email_as_service=RL
3 changes: 3 additions & 0 deletions orcid-core/src/main/resources/i18n/email_common_xx.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ email.common.privacy_policy=X
email.common.privacy_policy_2=X
email.common.address1=X
email.common.address2=X
email.welcome.your_id.id=X
email.welcome.your_id.link=X
email.common.received_email_as_service=X
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@

import org.orcid.persistence.jpa.entities.EventEntity;

import java.util.List;

/**
*
* @author Daniel Palafox
*
*/
public interface EventDao extends GenericDao<EventEntity, Long>{

boolean removeEvents(String orcid);

List<EventEntity> getEvents(String orcid);
public interface EventDao {

void createEvent(EventEntity eventEntity);

EventEntity find(long id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public interface ProfileDao extends GenericDao<ProfileEntity, String> {

void updateLastModifiedDateAndIndexingStatusWithoutResult(String orcid, Date lastModified, IndexingStatus indexingStatus);

public List<Triple<String, Boolean, Date>> findEmailsUnverfiedDays(int daysUnverified, int maxResults);
public List<Triple<String, String, Boolean>> findEmailsUnverfiedDays(int daysUnverified, EmailEventType eventSent);

String retrieveOrcidType(String orcid);

List<Object[]> findInfoForDecryptionAnalysis();
Expand Down Expand Up @@ -156,10 +156,10 @@ public interface ProfileDao extends GenericDao<ProfileEntity, String> {
public List<Object[]> getSigninLock(String orcid);

public void startSigninLock(String orcid);

public void resetSigninLock(String orcid);

public void updateSigninLock(String orcid, Integer count);

boolean haveMemberPushedWorksOrAffiliationsToRecord(String orcid, String clientId);
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
package org.orcid.persistence.dao.impl;

import org.orcid.persistence.aop.UpdateProfileLastModified;
import javax.annotation.Resource;
import javax.persistence.EntityManager;

import org.orcid.persistence.dao.EventDao;
import org.orcid.persistence.jpa.entities.EmailEntity;
import org.orcid.persistence.jpa.entities.EventEntity;
import org.orcid.persistence.jpa.entities.SpamEntity;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.Query;
import javax.persistence.TypedQuery;
import java.util.List;

/**
* @author Daniel Palafox
*/
public class EventDaoImpl extends GenericDaoImpl<EventEntity, Long> implements EventDao {
public class EventDaoImpl implements EventDao {

@Resource(name="entityManager")
protected EntityManager entityManager;

public EventDaoImpl() {
super(EventEntity.class);
}

@Override
public List<EventEntity> getEvents(String orcid) {
TypedQuery<EventEntity> query = entityManager.createQuery("from EventEntity where orcid=:orcid", EventEntity.class);
query.setParameter("orcid", orcid);
List<EventEntity> results = query.getResultList();
return results.isEmpty() ? null : results;
}

}

@Override
@Transactional
Expand All @@ -35,11 +26,8 @@ public void createEvent(EventEntity eventEntity) {
}

@Override
@Transactional
public boolean removeEvents(String orcid) {
Query query = entityManager.createQuery("delete from EventEntity where orcid = :orcid");
query.setParameter("orcid", orcid);
query.executeUpdate();
return query.executeUpdate() > 0;
public EventEntity find(long id) {
return entityManager.find(EventEntity.class, id);
}

}
Loading

0 comments on commit 6484fe6

Please sign in to comment.