Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ORCID/ORCID-Source
Browse files Browse the repository at this point in the history
  • Loading branch information
amontenegro committed Feb 28, 2024
2 parents 3279481 + b2adbfe commit b3660c2
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 8 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## v2.51.6 - 2024-02-28

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

## v2.51.5 - 2024-02-28

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

- [#6999](https://github.com/ORCID/ORCID-Source/pull/6999): lmendoza/wordpress-headless

## v2.51.4 - 2024-02-27

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

## v2.51.3 - 2024-02-27

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.51.2...v2.51.3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1764,28 +1764,119 @@ public void test3_0() {

/**
* Deactivated elements tests
*/
@Test
public void testViewDeactivatedRecordDontThrowError() {
*/
@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewActivities() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewActivities(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewRecord() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewRecord(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewPerson() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewPerson(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewAddresses() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewAddresses(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewEducations() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewEducations(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewEmails() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewEmails(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewEmployments() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewEmployments(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewExternalIdentifiers() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewExternalIdentifiers(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewFundings() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewFundings(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewKeywords() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewKeywords(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewOtherNames() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewOtherNames(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewPeerReviews() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewPeerReviews(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewPersonalDetails() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewPersonalDetails(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewResearcherUrls() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewResearcherUrls(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewResearchResources() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewResearchResources(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordViewWorks() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0007", ScopePathType.READ_LIMITED);
serviceDelegator.viewWorks(deactivatedUserOrcid);
fail();
}

@Test(expected = DeactivatedException.class)
public void testDeactivatedRecordCreateWork() {
serviceDelegator.createWork(deactivatedUserOrcid, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,20 +355,21 @@ public Work updateWork(String orcid, Work work, boolean isApiRequest) {

Work workSaved = jpaJaxbWorkAdapter.toWork(workEntity);
WorkForm workFormSaved = WorkForm.valueOf(workSaved, maxContributorsForUI);
String devMessage = localeManager.resolveMessage("apiError.9010.developerMessage").replace("${activity}", "work");

if (workFormSaved.compare(WorkForm.valueOf(work, maxContributorsForUI))) {
SourceEntity sourceEntity = sourceManager.retrieveSourceEntity();
String client = null;
if (sourceEntity.getSourceProfile() != null && sourceEntity.getSourceProfile().getId() != null) {
client = sourceEntity.getSourceProfile().getId();
if(!StringUtils.equals(client, orcid) ) {
throw new OrcidForbiddenException(localeManager.resolveMessage("apiError.9010.developerMessage","work"));
throw new OrcidForbiddenException(devMessage );
}
}
if (sourceEntity.getSourceClient() != null && sourceEntity.getSourceClient().getClientName() != null) {
client = sourceEntity.getSourceClient().getClientName();
if(!StringUtils.equals(sourceEntity.getSourceClient().getClientId(), workEntity.getClientSourceId()) ) {
throw new OrcidForbiddenException(localeManager.resolveMessage("apiError.9010.developerMessage","work"));
throw new OrcidForbiddenException(devMessage );
}
}
LOGGER.info("There is no changes in the work with putCode " + work.getPutCode() + " send it by " + client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,8 @@ public Work updateWork(String orcid, Work work, boolean isApiRequest) {

if (workFormSaved.compare(WorkForm.valueOf(work, maxContributorsForUI))) {
if (activeSource != null) {

if(!activeSource.equals(workSaved.getSource())) {
throw new OrcidForbiddenException(localeManager.resolveMessage("apiError.9010.developerMessage","work"));
throw new OrcidForbiddenException(localeManager.resolveMessage("apiError.9010.developerMessage").replace("${activity}", "work"));
}
}

Expand Down
5 changes: 5 additions & 0 deletions orcid-core/src/main/java/org/orcid/core/togglz/Features.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@


public enum Features implements Feature {

@Label("Homepage Headless WordPress")
WORDPRESS_HOME_PAGE,


@Label("Registration 2.1: Add affiliations on registration")
REGISTRATION_2_1,

Expand Down

0 comments on commit b3660c2

Please sign in to comment.