use of org.orcid.jaxb.model.record_rc2.Biography in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testGetPublicBiographyUsingToken.
// Biography
@Test
public void testGetPublicBiographyUsingToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewBiography(ORCID);
assertNotNull(r);
Biography b = (Biography) r.getEntity();
assertNotNull(b);
assertNotNull(b.getLastModifiedDate());
assertNotNull(b.getLastModifiedDate().getValue());
assertEquals(Visibility.PUBLIC, b.getVisibility());
}
use of org.orcid.jaxb.model.record_rc2.Biography in project ORCID-Source by ORCID.
the class ManageProfileController method getBiographyForm.
@RequestMapping(value = "/biographyForm.json", method = RequestMethod.GET)
@ResponseBody
public BiographyForm getBiographyForm() {
Biography bio = biographyManager.getBiography(getCurrentUserOrcid(), profileEntityManager.getLastModified(getCurrentUserOrcid()));
BiographyForm form = BiographyForm.valueOf(bio);
if (form.getVisiblity() == null) {
ProfileEntity profile = profileEntityCacheManager.retrieve(getCurrentUserOrcid());
form.setVisiblity(Visibility.valueOf(profile.getActivitiesVisibilityDefault()));
}
return form;
}
use of org.orcid.jaxb.model.record_rc2.Biography in project ORCID-Source by ORCID.
the class BiographyManagerTest method testCreateBiography.
@Test
public void testCreateBiography() {
String orcid = "0000-0000-0000-0004";
Biography bio = new Biography();
bio.setContent("This is my biography");
bio.setVisibility(Visibility.LIMITED);
biographyManager.createBiography(orcid, bio);
Biography newBio = biographyManager.getBiography(orcid, 0);
assertNotNull(newBio);
assertEquals("This is my biography", newBio.getContent());
assertEquals(Visibility.LIMITED, newBio.getVisibility());
}
use of org.orcid.jaxb.model.record_rc2.Biography in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testPersonalDetails_When_AllPrivate_NoSource_ReadLimitedToken.
@Test
public void testPersonalDetails_When_AllPrivate_NoSource_ReadLimitedToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
Name name = createName(Visibility.PRIVATE);
Biography bio = createBiography(Visibility.PRIVATE);
OtherName o1 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherName o2 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherName o3 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherNames otherNames = new OtherNames();
otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
PersonalDetails p = new PersonalDetails();
p.setBiography(bio);
p.setName(name);
p.setOtherNames(otherNames);
orcidSecurityManager.checkAndFilter(ORCID_1, p);
assertNotNull(p);
assertNull(p.getName());
assertNull(p.getBiography());
assertNotNull(p.getOtherNames());
assertNotNull(p.getOtherNames().getOtherNames());
assertTrue(p.getOtherNames().getOtherNames().isEmpty());
}
use of org.orcid.jaxb.model.record_rc2.Biography in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testBio_CanRead_When_HaveReadScope_IsLimited.
@Test
public void testBio_CanRead_When_HaveReadScope_IsLimited() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
Biography bio = createBiography(Visibility.LIMITED);
orcidSecurityManager.checkAndFilter(ORCID_1, bio, ScopePathType.ORCID_BIO_READ_LIMITED);
}
Aggregations